Tudo que zipter98 postou
-
colocar limite de itens emcima do depot
local maxItems = 2 --Quantidade máxima de itens empilhados. local tableId = 3805 --ID da mesa do depot. function isWalkable(pos, creature, proj, pz) -- By Nord if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end if getTopCreature(pos).uid > 0 and creature then return false end if getTileInfo(pos).protection and pz then return false end local n = not proj and 2 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function canThrowObject(fromPos, toPos) -- by OrochiElf while(fromPos.x ~= toPos.x or fromPos.y ~= toPos.y) do local fromPos = getPosByDir(fromPos, getDirectionTo(fromPos, toPos)) if fromPos.x == toPos.x and fromPos.y == toPos.y then return true elseif not isWalkable(fromPos) then return false end end return true end function onMoveItem(cid, item, count, toContainer, fromContainer, fromPos, toPos) if getTileItemById(toPos, tableId).uid > 0 then if not canThrowObject((fromPos.x == 65535 and fromPos.y == 64) and getThingPos(cid) or fromPos, toPos) then return doPlayerSendCancel(cid, "Sorry, not possible.") and false elseif getTileInfo(toPos).items - 1 >= maxItems then return doPlayerSendCancel(cid, "Only "..maxItems.." items above the depot.") and false end end return true end
-
(Resolvido)[Pedido]Algum scripter para min ajuda nesse script
Poderia postar a tabela pokevo, e também o erro que é imprimido no executável?
-
Pedido System Vip Da Para Todos
Tá, mas qual é seu VIP System?
-
(Resolvido)Evento matar outro player ganhar EXP
Substitua seu creaturescript por este: function onDeath(cid, corpse, deathList) local config = { exp = math.random(300000, 900000), killer_name = getCreatureName(deathList[1]), target_name = getCreatureName(cid) } --if getPlayerIp(cid) == getPlayerIp(deathList[1]) then return true end --se nao for testar em casa remova os 2 sinais(de menos) no começo do script. essa função é para evitar que alguem use MC para ganhar exp; if getGlobalStorageValue(9571) > -1 then if isPlayer(deathList[1]) then doPlayerSendTextMessage(deathList[1], MESSAGE_INFO_DESCR, "Você recebeu ".. config.exp .. ", de EXP por matar o ".. config.target_name ..".") doPlayerAddExp(deathList[1], config.exp) end end return true end Código da talkaction: function onSay(cid, words) if getGlobalStorageValue(9571) > -1 then setGlobalStorageValue(9571, -1) broadcastMessage("Experience on kill desactivated.") else setGlobalStorageValue(9571, 1) broadcastMessage("Experience on kill activated.") end return true end
-
Problemas ao usar a Pokedex
Não tem como te ajudar sem o arquivo pokedex.lua, de data/actions/scripts. Se possível, poste-o aqui concluirmos qual é, exatamente, o motivo do erro.
-
(Resolvido)[Quest] Estátuas Vivas
Ou, no step in: local directions = { --[itemid] = lookDirection, } trocar: doCreateMonster(monster, pos[x][1]) por: local m = doCreateMonster(monster, pos[x][1]) doCreatureSetLookDirection(m, directions[pos[x][2]])
-
(Resolvido)Sistema rare!
No seu caso (apenas um item com chance diferente), o script poderia ser escrito de maneira mais simples. Porém, como não postei este código apenas para você, mas também para qualquer um que queira usá-lo, optei por deixar assim. Espero que não se importe (a funcionalidade não será afetada). E fiz uma pequena edição no código para itens com mesma chance.
-
(Resolvido)Sistema rare!
Sabe fazer a tag? local price = {itemid, count} --Troque itemid pelo ID do item que será cobrado, e count pela quantia. local items = { --[itemid] = {chance, count}, >> Onde itemid é o ID do item, chance, obviamente, a chance dele ser sorteado, e count, a quantidade. --Exemplo: >> Para adicionar mais items, siga o modelo indicado acima. [itemid] = {chance, count}, --[2160] = {50, 10}, >> Assim, o item de ID 2160 teria 50% de chance de ser sorteado. Quantidade -> 10. } function onUse(cid) local _table = {} local number = math.random(1, 100) local item = 0 if doPlayerRemoveItem(cid, price[1], price[2]) then for itemid, chance in pairs(items) do if item == 0 then item = itemid table.insert(_table, item) else if number <= chance[1] then local new_chance = math.abs(chance[1] - number) local old_chance = math.abs(items[item][1] - number) if new_chance < old_chance then if #_table > 0 then _table = {} end table.insert(_table, itemid) item = itemid elseif new_chance == old_chance then table.insert(_table, itemid) end end end end if item ~= 0 then if #_table > 1 then item = _table[math.random(#_table)] end local count = items[item][2] if not isItemStackable(item) then if count > 1 then for i = 1, count do doPlayerAddItem(cid, item, 1) end else doPlayerAddItem(cid, item, 1) end else doPlayerAddItem(cid, item, count) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You received: "..count.."x "..getItemNameById(item)..(count > 1 and "s" or "")..".") end else return doPlayerSendCancel(cid, "You do not have "..price[2].." "..getItemNameById(price[1])..".") end return true end
-
(Resolvido)[Pedido]Algum scripter para min ajuda nesse script
Apenas dei uma rápida lida no código, então, além do que vou citar, talvez hajam mais erros. Logo darei uma olhada com calma. Troque ambos os: local Dex =""..getMoveDexDescr(pokemon,1).."" por: local Dex = getMoveDexDescr(getCreatureName(pokemon), 1)
-
(Resolvido)[Pedido]Algum scripter para min ajuda nesse script
A função em si está funcionando perfeitamente. Caso queira confirmar você mesmo, basta testá-la em um depurador de lua. Se possível, envie o código em que você está executando esta função. Provavelmente o erro está nele.
-
[pedido] Npc que teleporta 1x por player.
Estou de saída no momento. Quando possível, tentarei fazer este NPC.
- CMS #01 - Sala Secreta
-
[pedido] Npc que teleporta 1x por player.
Sabe fazer o arquivo XML? 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 local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local toPos = {x = x, y = y, z = z} --Para onde o jogador será teleportado. local storage = 8191 if msgcontains(msg:lower(), "tutorial area") or msgcontains(msg:lower(), "tutorial") then if getPlayerStorageValue(cid, storage) > -1 then selfSay("You already did the tutorial.", cid) talkState[talkUser] = 0 return true else selfSay("In the tutorial area you'll be shown how to properly use your fishind rod. Do you want to be teleported?", cid) talkState[talkUser] = 1 return true end elseif msgcontains(msg:lower(), "yes") and talkState[talkUser] == 1 then selfSay("Good luck.", cid) doTeleportThing(cid, toPos) setPlayerStorageValue(cid, storage, 1) talkState[talkUser] = 0 return true elseif msgcontains(msg:lower(), "no") and talkState[talkUser] == 1 then selfSay("Ok...", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
Piso Falante e Double EXP
Sem creaturescript ou globalevent é impossível fazer, pelo menos em lua, o segundo pedido. Já o primeiro, farei em action e editarei este comentário. Sabe fazer a tag? local texts = { {{x = x, y = y, z = z}, "Text"}, --{{posição}, "texto"}, {{x = x, y = y, z = z}, "Text"}, {{x = x, y = y, z = z}, "Text"}, } local interval = 3 --Intervalo entre as mensagens, em segundos. local storage = 8017 local function sendEff() for i = 1, #texts do doSendAnimatedText(texts[i][1], texts[i][2], math.random(1, 255)) end addEvent(sendEff, interval * 1000) end function onUse(cid) if getGlobalStorageValue(storage) < 1 then setGlobalStorageValue(storage, 1) sendEff() end return true end Novamente: por action, algum jogador deverá dar use em um item para o script ser executado.
-
(Resolvido)[Pedido]Algum scripter para min ajuda nesse script
Supondo que a tabela movestable estivesse assim: local movestable = { ["Bulbasaur"] = { move1 = {name = "Razor Leaf", level = 20, cd = 7, target = 1}, }, } refiz sua função da seguinte maneira: function getMoveDexDescr(pokemon, number) if not pokemon then return "" elseif not movestable[pokemon] then return print(pokemon.." doesn't exist on movestable.") end local moves = { [1] = movestable[pokemon].move1, [2] = movestable[pokemon].move2, [3] = movestable[pokemon].move3, [4] = movestable[pokemon].move4, [5] = movestable[pokemon].move5, [6] = movestable[pokemon].move6, [7] = movestable[pokemon].move7, [8] = movestable[pokemon].move8, [9] = movestable[pokemon].move9, [10] = movestable[pokemon].move10, } if not moves[number] then return print("move"..number.." isn't a valid move on "..pokemon..".") end local movement = moves[number] local name, level, cooldown, target = movement.name, movement.level, movement.cd, movement.target if target == 1 then target = "Sim" else target = "Não" end return "\n Nome:"..name.."\n Level:"..level.."\n Tempo:"..cooldown.."\n Alvo:"..target.."." end
-
Piso Falante e Double EXP
Eu optei por fazer o primeiro pedido em um creaturescript pois, por action, seria necessário algum jogador dar use em um item para o script ser executado. data/creaturescripts/scripts: local texts = { {{x = x, y = y, z = z}, "Text"}, --{{posição}, "texto"}, {{x = x, y = y, z = z}, "Text"}, {{x = x, y = y, z = z}, "Text"}, } local interval = 3 --Intervalo entre as mensagens, em segundos. local storage = 8017 local function sendEff() for i = 1, #texts do doSendAnimatedText(texts[i][1], texts[i][2], math.random(1, 255)) end addEvent(sendEff, interval * 1000) end function onThink(cid, interval) if getGlobalStorageValue(storage) < 1 then setGlobalStorageValue(storage, 1) sendEff() end return true end function onLogin(cid) registerCreatureEvent(cid, "Effects") return true end Tags: <event type="think" name="Effects" event="script" value="nome_do_arquivo.lua"/> <event type="login" name="EffLogin" event="script" value="nome_do_arquivo.lua"/> Segundo pedido (não testei): local config = { count = 40, --Número mínimo de jogadores online para ter double experience. rate = 2.0, --Rate de EXP. storage = 4091, } function onLogin(cid) if getGlobalStorageValue(config.storage) < 1 then if #getPlayersOnline() >= config.count then broadcastMessage(config.count.." jogadores online! Double experience ativada!") setGlobalStorageValue(config.storage, 1) for _, pid in pairs(getPlayersOnline()) do doPlayerSetExperienceRate(pid, config.rate) end end else doPlayerSetExperienceRate(cid, config.rate) end return true end function onLogout(cid) if getGlobalStorageValue(config.storage) > -1 then if #getPlayersOnline() - 1 < config.count then broadcastMessage("A double experience foi desativada. :/") setGlobalStorageValue(config.storage, -1) for _, pid in pairs(getPlayersOnline()) do doPlayerSetExperienceRate(pid, 1.0) end end end return true end Tags: <event type="login" name="ExpLogin" event="script" value="nome_do_arquivo.lua"/> <event type="logout" name="ExpLogout" event="script" value="nome_do_arquivo.lua"/>
- (Resolvido)Erro de Char e pokemons no creaturescripts
- (Resolvido)Erro de Char e pokemons no creaturescripts
-
Oque e Open Sources ?
Wikipédia tá aí pra isso.
-
(Resolvido)Erro de Char e pokemons no creaturescripts
[.spoiler]mensagem[./spoiler] sem os pontos. Mas enfim, baixarei os arquivos. EDIT: em IconSys.lua, troque: local x = icons[getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")] local y = icons[getItemAttribute(getPlayerSlotItem(cid, 3).uid, "poke")] por: local x, y = false, false if getPlayerSlotItem(cid, 8).uid > 0 then x = icons[getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")] end if getPlayerSlotItem(cid, 3).uid > 0 then y = icons[getItemAttribute(getPlayerSlotItem(cid, 3).uid, "poke")] end Troque, também: local balls = getItemsInContainerById(bp.uid, 12831) -- Shiny Dark if #balls >= 1 then for _, ball in pairs (balls) do local x = icons[getItemAttribute(ball, "poke")] doTransformItem(ball, x.off) doItemSetAttribute(ball, "ball", "Icone") doItemSetAttribute(ball, "morta", "yes") doItemSetAttribute(ball, "Icone", "yes") end end por: local balls = getItemsInContainerById(bp.uid, 12831) -- Shiny Dark if #balls >= 1 then for _, ball in pairs (balls) do local x = icons[getItemAttribute(ball, "poke")] if x and x.off then doTransformItem(ball, x.off) doItemSetAttribute(ball, "ball", "Icone") doItemSetAttribute(ball, "morta", "yes") doItemSetAttribute(ball, "Icone", "yes") end end end E, por último: acima de: local pokeball = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "ball") coloque: if getPlayerSlotItem(cid, 8).uid > 0 then depois, abaixo de: elseif pokeball == "Icone" and mortano == "yes" then doTransformItem(getPlayerSlotItem(cid, 8).uid, 12831) doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "Icone", "no") end coloque: end ficando: elseif pokeball == "Icone" and mortano == "yes" then doTransformItem(getPlayerSlotItem(cid, 8).uid, 12831) doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "Icone", "no") end end Se o erro ao logar permanecer, procure pelo código da função onPokeHealthChange(cid).
-
storage não salva
function onKill(cid, target, lastHit) if isPlayer(cid) and isPlayer(target) then if getPlayerFrags(cid) == 500 and getPlayerStorageValue(cid, 10129) == -1 then local quest = doPlayerAddItem(cid, 10129, 1) doItemSetAttribute(quest, "description", "Esse item foi obtido por "..getPlayerName(cid)..".") setPlayerStorageValue(cid, 10129, 1) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYAREA) elseif getPlayerFrags(cid) == 1000 and getPlayerStorageValue(cid, 10128) == -1 then local quest = doPlayerAddItem(cid, 10128, 1) doItemSetAttribute(quest, "description", "Esse item foi obtido por "..getPlayerName(cid)..".") setPlayerStorageValue(cid, 10128, 1) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYAREA) elseif getPlayerFrags(cid) == 2000 and getPlayerStorageValue(cid, 10127) == -1 then local quest = doPlayerAddItem(cid, 10127, 1) doItemSetAttribute(quest, "description", "Esse item foi obtido por "..getPlayerName(cid)..".") setPlayerStorageValue(cid, 10127, 1) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYAREA) end end return true end
-
(Resolvido)Dado premiado
De nada.
-
(Resolvido)Dado premiado
Essa função é parte da minha assinatura, não do código que você pediu. A quantia do item, como já expliquei duas vezes, você coloca onde está count. Por exemplo: [2160] = {60, 50}, Desse jeito, o item de ID 2160 teria 60% de chance de ser obtido. Viriam 50 unidades deste item.
- (Resolvido)Erro de Char e pokemons no creaturescripts
-
(Resolvido)Dado premiado
Troca: local items = { --[itemid] = {chance, count}, [2160] = {50, 100}, [2158] = {70, 50}, } por: local items = { [itemid] = {chance, count}, [itemid] = {chance, count}, [itemid] = {chance, count}, [itemid] = {chance, count}, [itemid] = {chance, count}, [itemid] = {chance, count}, [itemid] = {chance, count}, [itemid] = {chance, count}, [itemid] = {chance, count}, [itemid] = {chance, count}, } Já deixei 10 linhas prontas (ou seja, 10 items). Basta você configurar. Substitua itemid pelo ID do item; chance pela chance, em porcentagem (1-100), de obter o item; count pela quantidade que virá do item. Para adicionar um novo item, basta adicionar (antes de }): [itemid] = {chance, count}, Se quiser remover um item, basta remover a linha referente a ele.