Ir para conteúdo

zipter98

Herói
  • Total de itens

    2553
  • Registro em

  • Última visita

  • Dias Ganhos

    72

Tudo que zipter98 postou

  1. local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) function onGetFormulaValues(cid, level, maglevel) min = (level * 2 + maglevel * 3) * 1 max = (level * 2 + maglevel * 3) * 1.75 return min, max end setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") local time = xxx --Cooldown, em segundos. local storage = 91812 --Uma storage qualquer que não esteja em uso no seu servidor. function onCastSpell(cid, var) if getPlayerStorageValue(cid, storage) > os.time() then --Checando se ainda está em cooldown. return doPlayerSendCancel(cid, "Wait "..getPlayerStorageValue(cid, storage) - os.time().." second(s) to use this spell again.") end setPlayerStorageValue(cid, storage, os.time() + time) --Setando CD na spell. return doCombat(cid, combat, var) end
  2. Tem duas opções: diretamente na tag ou manipulando storages no código lua da spell.
  3. Troque: local pokemon = flys[getPokemonName(getCreatureSummons(cid)[1])] if not pokemon then pokemon = flyItem[getPokemonName(getCreatureSummons(cid)[1])].outfit end if not speed then speed = flyItem[getPokemonName(getCreatureSummons(cid)[1])].speed end if not pokemon then pokemon = flyItem[getPokemonName(getCreatureSummons(cid)[1])].outfit end doPlayerSendTextMessage(cid, 27, "Type \"up\" or \"h1\" to fly higher and \"down\" or \"h2\" to fly lower.") doChangeSpeed(cid, -getCreatureSpeed(cid)) local speed = 500 + PlayerSpeed/5 + getSpeed(sid) * 6 * speedRate por: local pokemon = flys[getPokemonName(getCreatureSummons(cid)[1])] doPlayerSendTextMessage(cid, 27, "Type \"up\" or \"h1\" to fly higher and \"down\" or \"h2\" to fly lower.") doChangeSpeed(cid, -getCreatureSpeed(cid)) local speed = 500 + PlayerSpeed/5 + getSpeed(sid) * 6 * speedRate if not pokemon then pokemon = flyItem[getPokemonName(getCreatureSummons(cid)[1])].outfit speed = flyItem[getPokemonName(getCreatureSummons(cid)[1])].speed else pokemon = pokemon[1] end doChangeSpeed(cid, speed) setPlayerStorageValue(cid, 54844, speed) doSetCreatureOutfit(cid, {lookType = pokemon + 351}, -1) Atualizei o sistema naquele meu comentário anterior. Testei aqui e funcionou perfeitamente. Talvez hajam alguns erros no seu servidor por causa de algumas diferenças entre as bases.
  4. Nossa, esqueci um parênteses. Foi mal. Se possível, refaça os passos. EDIT: Encontrei alguns outros erros bobos. Daqui a pouco editarei meu comentário anterior com o sistema totalmente corrigido e testado.
  5. Sim, mas não postei porque pensei que você sabia fazer. <action itemid="ID_DO_ITEM" event="script" value="nome_do_arquivo.lua"/>
  6. :^) Não tem mais conquista de membro honorário? rip
  7. data/lib, configuration.lua: Coloque esta tabela: flyItem = { --["pokemon_name"] = {outfit = xxx (número do Dat Editor - 351), speed = xxx}, ["Raichu"] = {outfit = 2391, speed = 600}, } order.lua: Abaixo de: local pokemon = flys[getPokemonName(getCreatureSummons(cid)[1])] coloque: if not pokemon then pokemon = flyItem[getPokemonName(getCreatureSummons(cid)[1])].outfit else pokemon = pokemon[1] end abaixo de: local speed = flys[getPokemonName(getCreatureSummons(cid)[1])][2] coloque: if not speed then speed = flyItem[getPokemonName(getCreatureSummons(cid)[1])].speed else speed = speed[2] end Troque: doSetCreatureOutfit(cid, {lookType = pokemon[1] + 351}, -1) por: doSetCreatureOutfit(cid, {lookType = pokemon + 351}, -1) Depois, em data/creaturescripts/scripts, login.lua: Troque: doSetCreatureOutfit(cid, {lookType = flys[poke][1] + 351}, -1) por: local outfit = flys[poke] if not outfit then outfit = flyItem[poke].outfit else outfit = outfit[1] end doSetCreatureOutfit(cid, {lookType = outfit + 351}, -1) Depois, em data/actions/scripts, order.lua: Troque todos os: isInArray(skills["fly"], getPokemonName(mysum)) por: isInArray(skills["fly"], getPokemonName(mysum)) or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "flyItem") Cuidado para não errar algum caractere. Ainda em data/actions/scripts, crie um arquivo com extensão .lua e coloque o seguinte conteúdo: function onUse(cid, item, fromPosition, itemEx, toPosition) if isCreature(itemEx.uid) then return doPlayerSendCancel(cid, "Use this in pokeballs.") elseif not getItemAttribute(itemEx.uid, "poke") then return doPlayerSendCancel(cid, "Use this in pbs w/ pokemons.") elseif not flyItem[getItemAttribute(itemEx.uid, "poke")] then return doPlayerSendCancel(cid, "You can't use this item on this pokemon.") elseif getItemAttribute(getPlayerSlotItem(cid, 8).uid, "flyItem") then return doPlayerSendCancel(cid, "This pokemon can already fly.") end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Now your pokemon can fly.") doItemSetAttribute(itemEx.uid, "flyItem", true) doRemoveItem(item.uid, 1) return true end
  8. Você não copiou metade do código.
  9. zipter98

    Spell stop

    A estátua será um monstro ou item?
  10. local config = { name = "monster_name", --Nome do monstro. medal = xxx, --ID da medalha. damagePrizes = { --[{minDamage, maxDamage}] = {{itemid, count}, {itemid, count}, {itemid, count}, ...}, [{1, 1000}] = {{9281, 1}, {2160, 50}}, [{1001, 2000}] = {{9281, 1}, {2160, 50}, {2191, 100}, {9282, 1}}, }, storage = 91828, } function onStatsChange(cid, attacker, type, combat, value) if isPlayer(attacker) and isMonster(cid) and getCreatureName(cid) == config.name and type == STATSCHANGE_HEALTHLOSS then local damage = getPlayerStorageValue(attacker, config.storage) < 1 and 0 or getPlayerStorageValue(attacker, config.storage) setPlayerStorageValue(attacker, config.storage, damage + value) end return true end function onDeath(cid, corpse, deathList) for _, pid in pairs(deathList) do local damage, prizes = getPlayerStorageValue(pid, config.storage), {} for dmg, items in pairs(config.damagePrizes) do if damage >= dmg[1] and damage <= dmg[2] then prizes = items break end end if #prizes > 0 then local prize = prizes[math.random(#prizes)] doPlayerSendTextMessage(pid, 27, "For helping killing "..config.name..", you received a medal and "..prize[2].."x "..getItemNameById(prize[1])..".") doPlayerAddItem(pid, prize[1], prize[2]) doItemSetAttribute(doPlayerAddItem(pid, config.medal, 1), "description", "Medalha de honra ganha por "..getCreatureName(pid).." por ajudar a derrotar o "..config.name.." no dia "..os.date("%D")..".") setPlayerStorageValue(pid, config.storage, -1) end end db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = "..config.storage) return true end
  11. local monsters = {"Demon", "Frost Dragon", "Hydra", "Dragon Lord", "Dragon"} local time_min, max = 25, 60 local premios, gold = {{2160, 10}, {2157, 5}}, 10000 function winMonsterEvent() local max_sto, winner = 0, 0 local monster = getGlobalStorageValue(1919211) for _, pid in pairs(getPlayersOnline()) do local sto = getPlayerStorageValue(pid, 1814210) if sto > max_sto then max_sto = sto winner = pid end end if isPlayer(winner) then local artigo = getPlayerSex(winner) == 0 and "A jogadora" or "O jogador" doBroadcastMessage(artigo.." "..getCreatureName(winner).." matou "..getPlayerStorageValue(winner, 1814210).." "..monster.."s e venceu o evento, parabens!") for _, prize in pairs(premios) do doPlayerAddItem(winner, prize[1], prize[2]) end doPlayerAddMoney(winner, gold) else doBroadcastMessage("O evento terminou e nao houve nenhum vencedor.") end setGlobalStorageValue(1919211, 0) end function onTime() local random = math.random(1, #monsters) local time = math.random(time_min, max) for _, pid in pairs(getPlayersOnline()) do doPlayerSetStorageValue(pid, 1814210, 0) end setGlobalStorageValue(1919211, monsters[random]) doBroadcastMessage("O evento comecou e vai durar "..time.." minuto. O monstro sorteado foi "..monsters[random].."! Quem matar mais deles ate o fim sera o vencedor!") addEvent(winMonsterEvent, time*1000*60) return true end Tags: <globalevent name="Evento1" time="13:00" event="script" value="nome_do_arquivo.lua"/> <globalevent name="Evento2" time="17:00" event="script" value="nome_do_arquivo.lua"/> <globalevent name="Evento3" time="23:00" event="script" value="nome_do_arquivo.lua"/>
  12. Action: local config = { reflectBonus = 2, --Bônus de reflect, em %. failChance = 50, --Chance de falhar, em porcentagem. types = {"armor", "legs", "helmet", "boots"}, noReflect = {1, 2, 3, 5, 6} --Tipos de armamento bloqueados (valores podem ser conferidos em 000-constant.lua, data/lib) } function onUse(cid, item, fromPos, itemEx, toPos) if itemEx.itemid < 100 then return doPlayerSendCancel(cid, "Use this in valid itens.") elseif isInArray(config.noReflect, getItemWeaponType(itemEx.uid)) then return doPlayerSendCancel(cid, "Use this in valid itens.") elseif getItemAttribute(itemEx.uid, "reflect") then return doPlayerSendCancel(cid, "This item has already a reflect bonus.") elseif math.random(1, 100) > config.failChance then return doPlayerSendTextMessage(cid, 27, "Sorry, your item didn't get a reflect bonus. Good luck at the next try! =]"), doRemoveItem(item.uid, 1) end local checkItemName for i = 1, #config.types do if getItemNameById(itemEx.itemid):find(config.types[i]) then checkItemName = true break end end if not checkItemName then return doPlayerSendCancel(cid, "Use this in valid itens.") end doPlayerSendTextMessage(cid, 27, "Congratulations, now your item has a reflect bonus of "..config.reflectBonus.."%!") doItemSetAttribute(itemEx.uid, "reflect", config.reflectBonus) doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid).." ref "..config.reflectBonus.."%") doRemoveItem(item.uid, 1) return true end Creaturescript (não se esqueça de registrar o evento em login.lua): function onStatsChange(cid, attacker, type, combat, value) if isPlayer(cid) and isCreature(attacker) and type == STATSCHANGE_HEALTHLOSS then local bonusReflect = 0 for i = 1, 10 do local item = getPlayerSlotItem(cid, i).uid if item > 0 and getItemAttribute(item, "reflect") then bonusReflect = bonusReflect + getItemAttribute(item, "reflect") end end if bonusReflect > 0 then local damage = value * bonusReflect / 100 doSendAnimatedText(getThingPos(attacker), -damage, COLOR_RED) doCreatureAddHealth(attacker, -damage) end end return true end
  13. Há algum outro evento com nome "tp"?
  14. Tente esse e informe se alguma coisa é imprimida no console (1/2): local tpId = 1387 local tps = { ["Little Corym Charlatan"] = {pos = {x=414, y=91, z=11}, toPos = {x=409, y=93, z=11}, time = 30}, } function removeTp(tp) local t = getTileItemById(tp.pos, tpId) if t then doRemoveItem(t.uid, 1) doSendMagicEffect(tp.pos, CONST_ME_POFF) end end function onKill(cid, target) print(1) local tp = tps[getCreatureName(target)] if isPlayer(cid) and isMonster(target) and tp then print(2) doCreateTeleport(tpId, tp.toPos, tp.pos) doCreatureSay(target, "A teleport appeared near and will disappear in "..tp.time.." seconds.", TALKTYPE_ORANGE_1) doCreatureSay(target, "You have killed the disorder and proved be trustworthy", TALKTYPE_ORANGE_1) setPlayerStorageValue(cid, 21321, 1) addEvent(removeTp, tp.time*1000, tp) end return true end
  15. Sobre meu código, você disse que não estava acontecendo nada quando o monstro morria, certo? Modifiquei o script. Agora vai funcionar direitinho.
  16. Ah sim, esqueci de modificar o parâmetro. Bem lembrado. Sobre o uso de metamétodos e afins do TFS 1.x+, não adaptei pois, como o autor mesmo disse, o problema era só na storage.
  17. Registre esse evento em login.lua, não no arquivo do monstro. Esqueci de avisar, foi mal.
  18. Uma opção é converter o código para outro callback, como, por exemplo, onKill. local tpId = 1387 local tps = { ["Little Corym Charlatan"] = {pos = {x=414, y=91, z=11}, toPos = {x=409, y=93, z=11}, time = 30}, } function removeTp(tp) local t = getTileItemById(tp.pos, tpId) if t then doRemoveItem(t.uid, 1) doSendMagicEffect(tp.pos, CONST_ME_POFF) end end function onKill(cid, target) local tp = tps[getCreatureName(target)] if isPlayer(cid) and isMonster(target) and tp then doCreateTeleport(tpId, tp.toPos, tp.pos) doCreatureSay(target, "A teleport appeared near and will disappear in "..tp.time.." seconds.", TALKTYPE_ORANGE_1) doCreatureSay(target, "You have killed the disorder and proved be trustworthy", TALKTYPE_ORANGE_1) setPlayerStorageValue(cid, 21321, 1) addEvent(removeTp, tp.time*1000, tp) end return true end É possível fazer por onStatsChange também.
  19. Você está setando a storage no monstro que está morrendo (cid). local tpId = 1387 local tps = { ["Little Corym Charlatan"] = {pos = {x=414, y=91, z=11}, toPos = {x=409, y=93, z=11}, time = 30}, } function removeTp(tp) local t = getTileItemById(tp.pos, tpId) if t then doRemoveItem(t.uid, 1) doSendMagicEffect(tp.pos, CONST_ME_POFF) end end function onDeath(cid, corpse, deathList) local tp = tps[getCreatureName(cid)] if tp then doCreateTeleport(tpId, tp.toPos, tp.pos) doCreatureSay(cid, "A teleport appeared near and will disappear in "..tp.time.." seconds.", TALKTYPE_ORANGE_1) doCreatureSay(cid, "You have killed the disorder and proved be trustworthy", TALKTYPE_ORANGE_1) setPlayerStorageValue(deathList[1], 21321, 1) addEvent(removeTp, tp.time*1000, tp) end return true end
  20. Para ser sincero, não li por inteiro esses códigos, então talvez hajam mais erros. Corrigido.
  21. Não.
  22. local Config = { Monsters = { -- ["Name"] = {amount = quantidade} ["Demon"] = {amount = 5}, ["Hydra"] = {amount = 10}, }, StoragePro = 54661, -- Não mexer se não souber editar Money = 100 -- Dinheiro } function onKill(cid, target) if not isMonster(target) and getPlayerStorageValue(cid, Config.StoragePro) >= (2 + #Config.StoragePro) then return false end local monster = Config.Monsters[getCreatureName(target):lower()] if monster then local sto = getPlayerStorageValue(cid, monster) if sto < (monster.amount - 1) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Task message: [" .. (sto + 1) .. "/" .. monster.amount .. "] of " .. getCreatureName(target) .. ".") setPlayerStorageValue(cid, monster, (sto + 1)) elseif sto == (monster.amount - 1) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations!! you have killed" .. (sto + 1) .. "/" .. monster.amount .. "] of " .. getCreatureName(target) .. "s ands and completed the task.") setPlayerStorageValue(cid, monster, (sto + 1)) setPlayerStorageValue(cid, Config.StoragePro, (getPlayerStorageValue(cid, Config.StoragePro) + 1)) end end return true end function onLogin(cid) registerCreatureEvent(cid, 'taskNpc') return true end NPC: local Config = { Monsters = { -- ["Name"] = {amount = quantidade} ["Demon"] = {amount = 30}, ["Hydra"] = {amount = 10}, }, StoragePro = 54661, -- Não mexer se não souber editar Money = 100 -- Dinheiro } 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 msg = msg:lower() if msgcontains(msg, "mission") then if getPlayerStorageValue(cid, Config.StoragePro) < 1 then selfSay("A missão para promovido custa " .. Config.Money .. " você aceita fazer ?", cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, Config.StoragePro) == (2 + #Config.Monsters) then selfSay("Você já cumpriu a missão peça pra ser {promovido}.", cid) talkState[talkUser] = 2 elseif getPlayerStorageValue(cid, Config.StoragePro) == (3 + #Config.Monsters) then selfSay("Voce já terminou as missões, pode ir em embora!", cid) talkState[talkUser] = 0 end elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then if doPlayerRemoveMoney(cid, Config.Money) then local text = "" for monsters, v in pairs(Config.Monsters) do text = text .. ", " text = text .. v.amount .. " {" .. monsters .. "}" end npcHandler:say("A missão é matar esses monstros para mim" .. text .. ".", cid) for i, _ in pairs(Config.Monsters) do setPlayerStorageValue(cid, i, 0) end setPlayerStorageValue(cid, Config.StoragePro, 1) talkState[talkUser] = 0 else selfSay("Você não tem money suficiente!", cid) talkState[talkUser] = 0 end elseif msgcontains(msg, "no") and talkState[talkUser] == 2 then selfSay("Até logo!", cid) talkState[talkUser] = 0 end if msgcontains(msg, "lista") and getPlayerStorageValue(cid, Config.StoragePro) < (#Config.Monsters + 3) then local text, n = "", 0 for monsters, v in pairs(Config.Monsters) do local sto = getPlayerStorageValue(cid, monsters) if sto < v.amount then n = n + 1 text = text .. ", " text = text .. (tostring(sto) < tostring(1) and v.amount or (tostring(v.amount) - tostring(sto))) .. " {" .. monsters .. "}" end end text = text:sub(3) if n > 1 then selfSay("Para terminar sua missão você ainda tem que matar esses monstros : " .. text, cid) talkState[talkUser] = 0 elseif n == 1 then selfSay("Você só tem mais um monstro à matar : " .. text, cid) talkState[talkUser] = 0 else selfSay("Você já terminou de matar os monstro que lhe pedi, agora sim tu é digno de ser {promovido}.", cid) talkState[talkUser] = 2 end elseif msgcontains(msg, "promovido") and talkState[talkUser] == 2 then selfSay("Aqui está sua promoção jovem soldado!!", cid) setPlayerVocation(cid, (getPlayerVocation(cid) + 4)) setPlayerStorageValue(cid, Config.StoragePro, (#Config.Monsters + 3)) -- Para deixar em utilizavel a storage para outras coisas for monsters, _ in pairs(Config.Monsters) do setPlayerStorageValue(cid, monsters, -1) end talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  23. Na linha 55, troque: (#Config.Monster + 3) por: (#Config.Monsters + 3)
  • Quem Está Navegando   0 membros estão online

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