Postado Outubro 31, 2017 7 anos 17 horas atrás, Adriano SwaTT disse: Boa tarde, Poderia ser criado em movements o code para tal ação. Não creio ser difícil, caso ainda não tenha conseguido, me avise e posso te ajudar. Boa sorte. Como crio essa função? Tentei procurar por palavras chaves em tópicos aqui no tibiaking mas nao encontrei, e nem em 1 ou 2 foruns fora esse
Postado Outubro 31, 2017 7 anos 1 hora atrás, kukas9 disse: Como crio essa função? Tentei procurar por palavras chaves em tópicos aqui no tibiaking mas nao encontrei, e nem em 1 ou 2 foruns fora esse Tente assim: Registre em movements.xml como equip e deequip como abaixo (mudando apenas a ID do item): <movevent type="Equip" itemid="1294" slot="head" event="script" value="buffHelmet.lua"/> <movevent type="DeEquip" itemid="1294" slot="head" event="script" value="buffHelmet.lua"/> E o script em .LUA como de costume e use esse buffHelmet.lua. local cfg = { lifePercent = 40, -- value in percent } function onEquip(cid, item, slot) if isPlayer(cid) then maxHealth = getCreatureMaxHealth(cid) healthValue = (maxHealth + math.ceil((maxHealth / 100) * cfg.lifePercent)) setCreatureMaxHealth(cid, healthValue) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have equiped your '..getItemNameById(item.itemid)..' and your life points was buffed in '..cfg.lifePercent..'%.') return true end end function onDeEquip(cid, item, slot) if isPlayer(cid) then maxHealth = getCreatureMaxHealth(cid) healthValue = (maxHealth - math.ceil((maxHealth / 100) * cfg.lifePercent)) setCreatureMaxHealth(cid, healthValue) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Your buff of life points was removed.') return true end end ______________________________________________________________________________________________________________________ Ao @Ribeiro Foda Use o mesmo esquema no movements.xml e use esse script em seu respectivo .LUA. local cfg = { lifeAmount = 150, -- Amount of Life } function onEquip(cid, item, slot) if isPlayer(cid) then maxHealth = getCreatureMaxHealth(cid) healthValue = (maxHealth + cfg.lifeAmount) setCreatureMaxHealth(cid, healthValue) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have equiped your '..getItemNameById(item.itemid)..' and buffed in '..cfg.lifeAmount..' life points.') return true end end function onDeEquip(cid, item, slot) if isPlayer(cid) then maxHealth = getCreatureMaxHealth(cid) healthValue = (maxHealth - cfg.lifeAmount) setCreatureMaxHealth(cid, healthValue) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Your buff of life points was removed.') return true end end Boa sorte para ambos. Editado Outubro 31, 2017 7 anos por Adriano SwaTT (veja o histórico de edições) Gosta do meu trabalho? Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs. Atenciosamente,Adriano Swatt' Para ver meus tutoriais acesse meu perfil.
Postado Novembro 1, 2017 7 anos 10 horas atrás, Adriano SwaTT disse: Tente assim: Registre em movements.xml como equip e deequip como abaixo (mudando apenas a ID do item): <movevent type="Equip" itemid="1294" slot="head" event="script" value="buffHelmet.lua"/> <movevent type="DeEquip" itemid="1294" slot="head" event="script" value="buffHelmet.lua"/> E o script em .LUA como de costume e use esse buffHelmet.lua. local cfg = { lifePercent = 40, -- value in percent } function onEquip(cid, item, slot) if isPlayer(cid) then maxHealth = getCreatureMaxHealth(cid) healthValue = (maxHealth + math.ceil((maxHealth / 100) * cfg.lifePercent)) setCreatureMaxHealth(cid, healthValue) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have equiped your '..getItemNameById(item.itemid)..' and your life points was buffed in '..cfg.lifePercent..'%.') return true end end function onDeEquip(cid, item, slot) if isPlayer(cid) then maxHealth = getCreatureMaxHealth(cid) healthValue = (maxHealth - math.ceil((maxHealth / 100) * cfg.lifePercent)) setCreatureMaxHealth(cid, healthValue) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Your buff of life points was removed.') return true end end ______________________________________________________________________________________________________________________ Ao @Ribeiro Foda Use o mesmo esquema no movements.xml e use esse script em seu respectivo .LUA. local cfg = { lifeAmount = 150, -- Amount of Life } function onEquip(cid, item, slot) if isPlayer(cid) then maxHealth = getCreatureMaxHealth(cid) healthValue = (maxHealth + cfg.lifeAmount) setCreatureMaxHealth(cid, healthValue) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have equiped your '..getItemNameById(item.itemid)..' and buffed in '..cfg.lifeAmount..' life points.') return true end end function onDeEquip(cid, item, slot) if isPlayer(cid) then maxHealth = getCreatureMaxHealth(cid) healthValue = (maxHealth - cfg.lifeAmount) setCreatureMaxHealth(cid, healthValue) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Your buff of life points was removed.') return true end end Boa sorte para ambos. Obrigado cara, vou testar aqui
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.