Postado Novembro 23, 2014 10 anos Nome: Rocky Boots Função: A cada 120 segundos "2 minutos", absorve metade de um dano acima de 1000. Autor: Nokia Ideia: FoxWorld Versão Testada: 8.40+ Bom, vamos a script. Em creaturescript.xml adicione: <event type="statschange" name="rockyBoots" script="rockyBoots.lua"/> Crie um arquivo em creaturescripts/scrips chamado rockyBoots.lua e adicione isso: function onStatsChange(cid, attacker, _type, combat, value) if isPlayer(cid) == TRUE then if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 7891 then local value = value if (_type == STATSCHANGE_HEALTHGAIN) or (_type == STATSCHANGE_MANAGAIN) then if (value >= 1000) then local metade = math.floor(value/2) if getPlayerStorageValue(cid, 41234) > os.time() then else setPlayerStorageValue(cid, 41234, os.time() + 120) doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -metade, -metade, CONST_ME_NONE) doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A sua rocky boots absorveu " .. metade .. " de dano.") return FALSE end end end end end return TRUE end Em creaturescripts/scripts/login.lua adicione a seguinte linha para registra o script: registerCreatureEvent(cid, "rockyBoots") Agora para saber o tempo que vai absorver novamente: Em actions.xml adicione: <action itemid="7891" script="rockyBoots.lua" /> Crie um arquivo em actions/scrips chamado rockyBoots.lua e adicione isso: function onUse(cid, item, frompos, item2, topos) if getPlayerStorageValue(cid, 41234) > os.time() then doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Rocky boots carregando. Faltam "..getPlayerStorageValue(cid, 41234) - os.time().." segundos.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Rocky boots protegendo.") end end No caso da bota seria a Magma Boots, imagem da bota em anexo. rocky boots.bmp Editado Novembro 23, 2014 10 anos por nookia (veja o histórico de edições) The medieval RpG Server [RpG] OLDWORLD OPEN TIBIA
Postado Novembro 23, 2014 10 anos Bom trabalho brother REP+, eu dei uma editada aqui, removendo algumas coisas que eu particularmente achei desnecessário. function onStatsChange(cid, attacker, type, combat, value) if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 7891 then if (type == STATSCHANGE_HEALTHGAIN) or (type == STATSCHANGE_MANAGAIN) then if (value >= 1000) then local metade = math.floor(value/2) if getPlayerStorageValue(cid, 41234) - os.time() then setPlayerStorageValue(cid, 41234, os.time() + 120) doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -metade, -metade, CONST_ME_NONE) doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A sua rocky boots absorveu " .. metade .. " de dano.") return FALSE end end end end return TRUE end Tony Araújo
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.