Postado Outubro 9, 2017 7 anos Fala galera do Tibia king! suaves na nave? ! uso: TFS 0.4tibia 8.60 Então venho pedir a voces um script meio diferente.. queria um item (x) que - se estiver na sua backpack já funcionaria é mais ou menos assim: o player com o (x) item na bp ele tem 1 vida extra "morrer" ficar com 0 de "vida" a vida e mana voltaria no máximo e nao perderia nada como exp e loot e o item sumiria da bpe aproveitando esse post: o item seria de quest que o player conseguiria repetir a quest depois de 1 semana para clicar no bau e pegar o item novamente não sei se tem como isso! quem puder me ajudar .. agradeço desde já!Valendo REP+++
Postado Outubro 9, 2017 7 anos Solução Em creaturescripts/scripts crie um arquivo.lua: Spoiler local extrahp = 200 -- hp extra adicionado local IMORTAL_ITEM = 1111 -- id do item function onThink(cid, interval) if not isPlayer(cid) then return true end if getPlayerItemCount(cid, IMORTAL_ITEM) == 1 and getPlayerStorageValue(cid, 80338) == -1 then local hp = getCreatureMaxHealth(cid) setCreatureMaxHealth(cid, hp + extrahp) doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid)) setPlayerStorageValue(cid, 80338, 1) return true end if getPlayerItemCount(cid, IMORTAL_ITEM) == 0 and getPlayerStorageValue(cid, 80338) == 1 then setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - extrahp) doCreatureAddHealth(cid, -extrahp) doRemoveCondition(cid, CONDITION_INFIGHT) setPlayerStorageValue(cid, 80338, -1) return true end return true end function onStatsChange(cid, attacker, type, combat, value) if not isPlayer(cid) then return true end if getPlayerItemCount(cid, IMORTAL_ITEM) == 1 and type == STATSCHANGE_HEALTHLOSS and value >= getCreatureHealth(cid) then doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid)) doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You were regenerated due the item of imortallity.") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYAREA) doPlayerRemoveItem(cid, IMORTAL_ITEM, 1) return false end return true end No login.lua, registre os eventos: registerCreatureEvent(cid, "ImortalItem") registerCreatureEvent(cid, "ImortalDeath") No creaturescripts.xml, adicione as tags: <event type="statschange" name="ImortalDeath" event="script" value="NOMEDOSEUARQUIVO.lua"/> <event type="think" name="ImortalItem" event="script" value="NOMEDOSEUARQUIVO.lua"/> Em actions/scripts, crie um arquivo.lua: Spoiler local time = {7, "day"} local IMORTAL_ITEM = 1111 -- id do item function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, 80339) > os.time() then doPlayerSendCancel(cid, "You need to wait until " .. os.date("%d %B %Y %X", getPlayerStorageValue(cid, 80339))..".") return true end doPlayerAddItem(cid, IMORTAL_ITEM, 1) doCreatureSay(cid, "You have received the item of imortallity.", TALKTYPE_ORANGE_1) setPlayerStorageValue(cid, 80339, mathtime(time) + os.time()) return true end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return "Error: Bad declaration in mathtime function." end Em actions.xml, adicione a tag: <action actionid="ACTION_ID_DO_BAÚ" script="NOMEDOSEUARQUIVO.lua" /> Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Outubro 9, 2017 7 anos Autor resolvido! Editado Outubro 9, 2017 7 anos por Leomonti (veja o histórico de edições)
Postado Outubro 19, 2017 7 anos Autor Em 09/10/2017 em 14:50, Dwarfer disse: Em creaturescripts/scripts crie um arquivo.lua: Ocultar conteúdo local extrahp = 200 -- hp extra adicionado local IMORTAL_ITEM = 1111 -- id do item function onThink(cid, interval) if not isPlayer(cid) then return true end if getPlayerItemCount(cid, IMORTAL_ITEM) == 1 and getPlayerStorageValue(cid, 80338) == -1 then local hp = getCreatureMaxHealth(cid) setCreatureMaxHealth(cid, hp + extrahp) doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid)) setPlayerStorageValue(cid, 80338, 1) return true end if getPlayerItemCount(cid, IMORTAL_ITEM) == 0 and getPlayerStorageValue(cid, 80338) == 1 then setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - extrahp) doCreatureAddHealth(cid, -extrahp) doRemoveCondition(cid, CONDITION_INFIGHT) setPlayerStorageValue(cid, 80338, -1) return true end return true end function onStatsChange(cid, attacker, type, combat, value) if not isPlayer(cid) then return true end if getPlayerItemCount(cid, IMORTAL_ITEM) == 1 and type == STATSCHANGE_HEALTHLOSS and value >= getCreatureHealth(cid) then doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid)) doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You were regenerated due the item of imortallity.") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYAREA) doPlayerRemoveItem(cid, IMORTAL_ITEM, 1) return false end return true end No login.lua, registre os eventos: registerCreatureEvent(cid, "ImortalItem") registerCreatureEvent(cid, "ImortalDeath") No creaturescripts.xml, adicione as tags: <event type="statschange" name="ImortalDeath" event="script" value="NOMEDOSEUARQUIVO.lua"/> <event type="think" name="ImortalItem" event="script" value="NOMEDOSEUARQUIVO.lua"/> Em actions/scripts, crie um arquivo.lua: Mostrar conteúdo oculto local time = {7, "day"} local IMORTAL_ITEM = 1111 -- id do item function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, 80339) > os.time() then doPlayerSendCancel(cid, "You need to wait until " .. os.date("%d %B %Y %X", getPlayerStorageValue(cid, 80339))..".") return true end doPlayerAddItem(cid, IMORTAL_ITEM, 1) doCreatureSay(cid, "You have received the item of imortallity.", TALKTYPE_ORANGE_1) setPlayerStorageValue(cid, 80339, mathtime(time) + os.time()) return true end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return "Error: Bad declaration in mathtime function." end Em actions.xml, adicione a tag: <action actionid="ACTION_ID_DO_BAÚ" script="NOMEDOSEUARQUIVO.lua" /> dwarfer...seguinte dwarfer tem como esse item durar 6 dias? pro player nao acumular
Postado Outubro 19, 2017 7 anos 11 horas atrás, Leomonti disse: 11 horas atrás, Leomonti disse: dwarfer...seguinte dwarfer tem como esse item durar 6 dias? pro player nao acumular Não estou em casa pra lhe passar mas você poderia usar o ENERGY RING como exemplo, dai é só pegar a parte do tempo e fazer (só teria que tirar a parte do OnUse). Editado Outubro 19, 2017 7 anos por Jean Junior (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.