Ir para conteúdo

zipter98

Herói
  • Total de itens

    2553
  • Registro em

  • Última visita

  • Dias Ganhos

    72

Tudo que zipter98 postou

  1. Action: local config = { maxSkill = 100, --Nível máximo de critical. pointPerItem = 1, --Quantos pontos em critical irá ganhar por item. storage = 9571, } function onUse(cid, item) if getPlayerStorageValue(cid, config.storage) >= config.maxSkill then return doPlayerSendCancel(cid, "You already reached the maximum critical level. ["..config.maxSkill.."]") end setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) > -1 and getPlayerStorageValue(cid, config.storage) + 1 or 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You received: "..config.pointPerItem.." point(s) on critical skill.\nPoints: ["..getPlayerStorageValue(cid, config.storage).."/"..config.maxSkill.."]") doRemoveItem(item.uid, 1) return true end Creaturescript: local config = { chancePerLevel = 3, --Chance, por nível, de acerto crítico. extraDamage = 50, --Bônus extra, em porcentagem, de dano. storage = 9571, } function onStatsChange(cid, attacker, type, combat, value) if isPlayer(attacker) and getPlayerStorageValue(attacker, config.storage) > -1 and type == STATSCHANGE_HEALTHLOSS then if math.random(config.chancePerLevel, config.chancePerLevel * 100) <= config.chancePerLevel * getPlayerStorageValue(attacker, config.storage) then value = math.floor(value * config.extraDamage / 100) doSendAnimatedText(getThingPos(cid), "CRITICAL!", 255) end end return true end Não se esqueça de registrar o evento em login.lua.
  2. Ok, troque: doTransformItem(getTileItemById(pos, i == 1 and config.door[1][n] or config.door[2]).uid, config.door[i + 1]) por: doTransformItem(getTileItemById(pos, i == 1 and config.door[1][1] or config.door[2]).uid, config.door[i + 1]) e troque: local j = i == 1 and config.door[2] or config.door[1][n] por: local j = i == 1 and config.door[2] or config.door[1][1] E 606 não é uma action, e sim o ID da porta.
  3. local config = { delay = 150, --Intervalo de tempo entre as "transformações" da porta, em milésimos. door = {{621, 606}, 622, 605}, --{ID da porta fechada, ID da porta aberta pela metade, ID da porta aberta}, ids = { [2701] = { {x = 1056, y = 1055, z = 7}, --Saffron-- }, }, } function onStepIn(cid, item, position) if config.ids[item.actionid] then for _, pos in pairs(config.ids[item.actionid]) do if type(config.door[1]) == "table" then for n = 1, #config.door[1] do if getTileItemById(pos, config.door[1][n]).uid > 0 then for i = 1, 2 do addEvent(function() doTransformItem(getTileItemById(pos, i == 1 and config.door[1][n] or config.door[2]).uid, config.door[i + 1]) end, i * config.delay) end end end else if getTileItemById(pos, config.door[1]).uid > 0 then for i = 1, 2 do addEvent(function() doTransformItem(getTileItemById(pos, i == 1 and config.door[1] or config.door[2]).uid, config.door[i + 1]) end, i * config.delay) end end end end end return true end function onStepOut(cid, item) if config.ids[item.actionid] then for _, pos in pairs(config.ids[item.actionid]) do local it = getTileItemById(pos, config.door[3]).uid if it > 0 then if getSpectators(pos, 1, 1) then return true end end end for _, pos in pairs(config.ids[item.actionid]) do if getTileItemById(pos, config.door[3]).uid > 0 then for i = 1, 2 do addEvent(function() if type(config.door[1]) == "table" then for n = 1, #config.door[1] do local j = i == 1 and config.door[2] or config.door[1][n] doTransformItem(getTileItemById(pos, i == 1 and config.door[3] or config.door[2]).uid, j) end else doTransformItem(getTileItemById(pos, i == 1 and config.door[3] or config.door[2]).uid, config.door[i == 1 and 2 or 1]) end end, i * config.delay) end end end end return true end
  4. Mesmo sendo apenas um item, você precisa colocar as posições dos cantos da porta. Segue a imagem, onde as posições circuladas são as que menciono:
  5. data/lib/050-function.lua, adicione as funções: function setEffect(cid, effect) setPlayerStorageValue(cid, 9671, effect) sendEffect(cid) end function sendEffect(cid) local delay = 500 --Intervalo, em milésimos de segundo, entre os efeitos. if getPlayerStorageValue(cid, 9671) > -1 then doSendMagicEffect(getThingPos(cid), getPlayerStorageValue(cid, 9671)) addEvent(function() if isPlayer(cid) then sendEffect(cid) end end, delay) end end data/creaturescripts/scripts, em login.lua: Abaixo de: function onLogin(cid) adicione: sendEffect(cid) Para adicionar um efeito ao jogador, use: setEffect(cid, efeito)
  6. Vejo que você configurou apenas uma posição em ids. Bem, deve-se colocar ambas as posições da porta.
  7. function onTarget(cid, target) if isSummon(target) and getCreatureMaster(target) == cid then return false end return true end function onStatsChange(cid, attacker, type, combat, value) if isSummon(cid) and getCreatureMaster(cid) == attacker then return false end return true end function onLogin(cid) registerCreatureEvent(cid, "targetSummon") registerCreatureEvent(cid, "attackSummon") return true end Tags: <event type="login" name="loginSummon" event="script" value="nome_do_arquivo.lua"/> <event type="target" name="targetSummon" event="script" value="nome_do_arquivo.lua"/> <event type="statschange" name="attackSummon" event="script" value="nome_do_arquivo.lua"/>
  8. Tag: <action itemid="12344;ID_do_outro_revive" event="script" value="revive.lua" blockwalls="1"/> Código: local revives = { [12344] = "1-199", --[ID_do_revive] = "minLevel-maxLevel", [xxx] = "200-99999", } function onUse(cid, item, frompos, item2, topos) if (item2.itemid == 13860 or item2.itemid == 13810) and (getPlayerGroupId(cid) < 4 or getPlayerGroupId(cid) > 6) then doRemoveItem(item2.uid) return true end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendCancel(cid, "You can't use revive during gym battles.") return true elseif getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendCancel(cid, "You can't do that while a duel.") --alterado v1.6 return true elseif isPlayer(item2.uid) then doPlayerSendCancel(cid, "Please, use revive only on pokeballs.") return true end if revives[item.itemid] then local level = revives[item.itemid]:explode("-") if getPlayerLevel(cid) < tonumber(level[1]) or getPlayerLevel(cid) > tonumber(level[2]) then return doPlayerSendCancel(cid, "You can't use this revive at this level.") end end if item2.uid ~= getPlayerSlotItem(cid, 8).uid then return true end if item2.uid ~= getPlayerSlotItem(cid, 8).uid and not isInArray(getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid), item2.uid) then return true end for a, b in pairs (pokeballs) do if not item2.itemid == b.on or not item2.itemid == b.off then doPlayerSendCancel(cid, "Please, use revive only on pokeballs.") return true end end local pokeball = getPlayerSlotItem(cid, 8) for a, b in pairs (pokeballs) do if item2.itemid == b.on or item2.itemid == b.off then --edited deixei igual ao do PXG doTransformItem(item2.uid, b.on) doSetItemAttribute(item2.uid, "hp", 1) for c = 1, 15 do local str = "move"..c setCD(item2.uid, str, 0) end setCD(item2.uid, "control", 0) setCD(item2.uid, "blink", 0) --alterado v1.6 doSendMagicEffect(getThingPos(cid), 13) doRemoveItem(item.uid, 1) doCureBallStatus(getPlayerSlotItem(cid, 8).uid, "all") doCureStatus(cid, "all", true) cleanBuffs2(item2.uid) --alterado v1.5 --[[if getPlayerStorageValue(cid, storage) > 0 then setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)-1) end--]] return true end end return true end
  9. Ah, isso explica. O script só vai funcionar se tanto quem morreu quanto quem matou forem players. Isso acontece pois o monstro Ceifeiro é invocado como summon do assassino.
  10. Sim, está certo. Você por acaso está morrendo para um monstro ou para um player?
  11. Ué. Tenta agora assim: local config = { time = 3, --Tempo para sumir, em segundos. monster = "ceifeiro", --Nome do monstro. } function onStatsChange(cid, attacker, type, combat, value) if value >= getCreatureHealth(cid) and isPlayer(cid) and isPlayer(attacker) and type == STATSCHANGE_HEALTHLOSS then doConvinceCreature(attacker, doCreateMonster(config.monster, getThingPos(cid))) doSendAnimatedText(getThingPos(cid), "DEATH!", 125) doSendMagicEffect(getThingPos(attacker), 65) addEvent(function() if isPlayer(attacker) then for _, summon in pairs(getCreatureSummons(attacker)) do if getCreatureName(summon):lower() == config.monster:lower() then doRemoveCreature(summon) break end end end end, config.time * 1000) end return true end function onLogin(cid) registerCreatureEvent(cid, "deathSystem") return true end Tags: <event type="statschange" name="deathSystem" event="script" value="nome_do_arquivo.lua"/> <event type="login" name="deathLogin" event="script" value="nome_do_arquivo.lua"/>
  12. Tenta assim: local config = { skills = {SKILL_FIST, SKILL_CLUB, SKILL_SWORD, SKILL_AXE, SKILL_DISTANCE, SKILL_SHIELD, SKILL__MAGLEVEL}, minSkill = { --[vocation_ID] = {fist, club, sword, axe, distance, shield, magic}, --NÃO altere a ordem. [1] = {20, 1, 10, 5, 10, 15, 10}, [2] = {10, 15, 10, 20, 10, 5, 20}, }, } function onLogin(cid) local voc = getPlayerVocation(cid) if config.minSkill[voc] then for _, skillId in pairs(config.skills) do if getPlayerSkillLevel(cid, skillId) < config.minSkill[voc][_] then doPlayerAddSkill(cid, skillId, config.minSkill[voc][_] - getPlayerSkillLevel(cid, skillId)) end end end return true end
  13. Hm, tenta assim: local config = { time = 3, --Tempo para sumir, em segundos. monster = "ceifeiro", --Nome do monstro. } function onPrepareDeath(cid, deathList) local killer = deathList[1] if isPlayer(killer) then doConvinceCreature(killer, doCreateMonster(config.monster, getThingPos(cid))) doSendAnimatedText(getThingPos(cid), "DEATH!", 125) doSendMagicEffect(getThingPos(cid), 65) addEvent(function() if isPlayer(killer) then for _, summon in pairs(getCreatureSummons(killer)) do if getCreatureName(summon):lower() == config.monster:lower() then doRemoveCreature(summon) break end end end end, config.time * 1000) end return true end function onLogin(cid) registerCreatureEvent(cid, "deathSystem") return true end Tags: <event type="preparedeath" name="deathSystem" event="script" value="nome_do_arquivo.lua"/> <event type="login" name="deathLogin" event="script" value="nome_do_arquivo.lua"/> Não registre nada no login.lua.
  14. Recomendaria colocar a tabela skillplayer dentro do callback. Como cid está sendo declarado no onUse, seu valor fora dele será nulo. Ah, também faltou no final um return true end.
  15. local level = 250 function onUse(cid, item, frompos, item2, topos) if (item2.itemid == 13860 or item2.itemid == 13810) and (getPlayerGroupId(cid) < 4 or getPlayerGroupId(cid) > 6) then doRemoveItem(item2.uid) return true end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendCancel(cid, "You can't use revive during gym battles.") return true elseif getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendCancel(cid, "You can't do that while a duel.") --alterado v1.6 return true elseif isPlayer(item2.uid) then doPlayerSendCancel(cid, "Please, use revive only on pokeballs.") return true elseif getPlayerLevel(cid) > level then return doPlayerSendCancel(cid, "You can't use this item at this level.") end if item2.uid ~= getPlayerSlotItem(cid, 8).uid then return true end if item2.uid ~= getPlayerSlotItem(cid, 8).uid and not isInArray(getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid), item2.uid) then return true end for a, b in pairs (pokeballs) do if not item2.itemid == b.on or not item2.itemid == b.off then doPlayerSendCancel(cid, "Please, use revive only on pokeballs.") return true end end local pokeball = getPlayerSlotItem(cid, 8) for a, b in pairs (pokeballs) do if item2.itemid == b.on or item2.itemid == b.off then --edited deixei igual ao do PXG doTransformItem(item2.uid, b.on) doSetItemAttribute(item2.uid, "hp", 1) for c = 1, 15 do local str = "move"..c setCD(item2.uid, str, 0) end setCD(item2.uid, "control", 0) setCD(item2.uid, "blink", 0) --alterado v1.6 doSendMagicEffect(getThingPos(cid), 13) doRemoveItem(item.uid, 1) doCureBallStatus(getPlayerSlotItem(cid, 8).uid, "all") doCureStatus(cid, "all", true) cleanBuffs2(item2.uid) --alterado v1.5 --[[if getPlayerStorageValue(cid, storage) > 0 then setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)-1) end--]] return true end end return true end
  16. zipter98

    Quest Simples

    Action: local config = { time = 10, --Tempo para fazer a quest, em minutos. toPosition = {x = x, y = y, z = z}, --Para onde os jogadores serão teleportados. positions = { {x = x, y = y, z = z}, --Posições que os jogadores devem ficar. {x = x, y = y, z = z}, {x = x, y = y, z = z}, {x = x, y = y, z = z}, }, level = 100, --Level mínimo para fazer a quest. storages = {8605, 8606}, } function onUse(cid) local pid = {} if getPlayerStorageValue(cid, config.storages[2]) > -1 then return doPlayerSendCancel(cid, "You already completed that quest.") end for _, online in pairs(getPlayersOnline()) do if getPlayerStorageValue(online, config.storages[1]) > -1 then return doPlayerSendCancel(cid, "Someone is at the quest right now.") end end for i, position in pairs(config.positions) do local p = getTopCreature(position).uid if p < 1 or not isPlayer(p) then return doPlayerSendCancel(cid, "Not enough players to start the quest.") elseif getPlayerLevel(p) < config.level then return doPlayerSendCancel(cid, "Some player is at a level below "..config.level..".") end pid[#pid + 1] = p end for _, player in pairs(pid) do doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "Good luck at the quest!\nTime: "..config.time.." minutes.") doTeleportThing(player, getClosestFreeTile(player, config.toPosition)) setPlayerStorageValue(player, config.storages[1], 1) end addEvent(function() for _, player in pairs(pid) do if isPlayer(player) and getPlayerStorageValue(player, config.storages[1]) > -1 then doPlayerSendTextMessage(player, 27, "Oh, timeout. Sorry. :/") setPlayerStorageValue(player, config.storages[1], -1) doTeleportThing(player, getTownTemplePosition(getPlayerTown(player))) end end end, config.time * 60 * 1000) return true end Tag: <action actionid="xxx" event="script" value="nome_do_arquivo.lua"/> Troque xxx pelo actionid. Creaturescript: function onLogout(cid) if getPlayerStorageValue(cid, 8605) > -1 then return doPlayerSendCancel(cid, "You can't logout on the quest.") and false end return true end function onLogin(cid) if getPlayerStorageValue(cid, 8605) > -1 then setPlayerStorageValue(cid, 8605, -1) end return true end Tags: <event type="logout" name="questLogout" event="script" value="nome_do_arquivo.lua"/> <event type="login" name="questLogin" event="script" value="nome_do_arquivo.lua"/> Em data/creaturescripts/scripts, abra o arquivo exp2.0.lua. Acima de: if getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 then Coloque: if getPlayerStorageValue(cid, 8605) > -1 then for _, pid in pairs(getPlayersOnline()) do if getPlayerStorageValue(pid, 8605) > -1 then doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid))) doPlayerSendTextMessage(pid, 27, "Someone died and you lost the quest. Better luck on the next time!") setPlayerStorageValue(pid, 8605, -1) end end doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) return false end No código de premiação da quest, coloque as seguintes linhas: setPlayerStorageValue(cid, 8605, -1) setPlayerStorageValue(cid, 8606, 1)
  17. zipter98

    Quest Simples

    É bem simples fazer isso. Poderia informar se a base que você está utilizando é algum derivado (por exemplo, PDA)?
  18. Oi, vi a ideia desse NPC em um lugar por aí e resolvi fazer. Consiste em um NPC que aprimora seu item (deve estar em uma das mãos - esquerda ou direita) a troco de um outro item (configurável). A cada nível de aprimoramento, seu item recebe um valor configurável no ataque, defesa e/ou armadura. Você pode configurar o nível de aprimoramento máximo, chance de falhar, valor adicional que o item receberá a cada aprimoração e, como já dito antes, o item que será cobrado pelo NPC. Em data/npc, crie um arquivo com extensão .XML, nomeie-o Upgrader, e coloque o seguinte conteúdo: <?xml version="1.0" encoding="UTF-8"?> <npc name="Upgrader" script="upgradenpc.lua" walkinterval="3000" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="134" head="39" body="113" legs="38" feet="0" addons="3" corpse="2212"/> <parameters> <parameter key="message_greet" value="Olá |PLAYERNAME|, voce gostaria de aprimorar o seu equipamento?"/> </parameters> </npc> Em data/npc/scripts, crie um arquivo com extensão .lua, nomeie-o upgradenpc.lua, e coloque o seguinte conteúdo: 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 config = { items = {12343, 10}, --Respectivamente, ID do item que o NPC irá cobrar e quantidade. maxBoost = 10, --Nível máximo do equipamento. failChance = 20, --Em porcentagem. upgradeValue = 1, --Valor adicional que o item receberá a cada aprimoração. } if msgcontains(msg:lower(), "yes") then for slot = 5, 6 do local item = getPlayerSlotItem(cid, slot) if item.uid > 0 then if getItemAttack(item) > 0 or getItemDefense(item) > 0 or getItemArmor(item) > 0 then if doPlayerRemoveItem(cid, config.items[1], config.items[2]) then local newUpgrade = (getItemAttribute(item.uid, "upgrade") or 0) + 1 if newUpgrade <= config.maxBoost then if math.random(1, 100) > config.failChance then doItemSetAttribute(item.uid, "name", getItemInfo(item.itemid).name.." [+"..newUpgrade.."]") if getItemAttack(item) > 0 then setItemAttack(item, getItemAttack(item) + config.upgradeValue) end if getItemDefense(item) > 0 then setItemDefense(item, getItemDefense(item) + config.upgradeValue) end if getItemArmor(item) > 0 then setItemArmor(item, getItemArmor(item) + config.upgradeValue) end doItemSetAttribute(item.uid, "upgrade", newUpgrade) selfSay("Seu equipamento foi aprimorado com sucesso.", cid) doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) else selfSay("Aah, parece que a aprimoração falhou! Mais sorte na próxima vez.", cid) end return true else return selfSay("Seu equipamento já alcançou o nível máximo.", cid) end else return selfSay("Você não tem "..config._item[2].."x "..getItemNameById(config._item[1])..(config._item[2] > 1 and "s" or "")..".", cid) end end end end selfSay("Parece que você não tem um item para aprimorar.", cid) elseif msgcontains(msg:lower(), "no") then selfSay("Tudo bem, então.") end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Versão testada: 8.54 Bem, é só isso, até mais.
  19. Iterar os jogadores online, insertando-os numa tabela para depois pegar um elemento aleatório dela, na minha opinião, é desnecessário, visto que você poderia somente usar: local players = getPlayersOnline() local winner = players[math.random(#players)] Mas, de resto, o código tá legal, especialmente o segundo. xD
  20. oi
    1. alanmtd

      alanmtd

      zipter preciso de sua ajuda! como faço pra vc me ajudar em um codigo.
  21. Hm, já vi o quê é. Enfim, movido.
  22. 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 ids = {{12149, 12150, 12151}, 2200} local feathers = ids[1] local str = "" local check = 0 local storage = 91821 if msgcontains(msg:lower(), "trade") or msgcontains(msg:lower(), "troca") then for i = 1, #feathers do if str == "" then str = "1 "..getItemNameById(feathers) else str = str..", 1 "..getItemNameById(feathers) end end if getPlayerStorageValue(cid, storage) > -1 then selfSay("You already traded with me.", cid) talkState[talkUser] = 0 return true else selfSay("Do you want trade "..str.." for 1 "..getItemNameById(ids[2]).."?", cid) talkState[talkUser] = 1 return true end elseif msgcontains(msg:lower(), "yes") and talkState[talkUser] == 1 then for i = 1, #feathers do if getPlayerItemCount(cid, feathers) > 0 then check = check + 1 end end if check == #feathers then selfSay("Thank you!", cid) for i = 1, #feathers do doPlayerRemoveItem(cid, feathers, 1) end doPlayerAddItem(cid, ids[2], 1) setPlayerStorageValue(cid, storage, 1) talkState[talkUser] = 0 return true else selfSay("Hey, you don't have all the feathers.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg:lower(), "no") and talkState[talkUser] == 1 then selfSay("Ok, good bye!") talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  23. Poderá realizar a troca apenas 1 vez por personagem?
  • Quem Está Navegando   0 membros estão online

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