Função matematica de porcentagem:
Citar(Valor/100)*percentual
Quanto vale 1% = valor divido por 100
Valor de 15% = quanto vale 1% multiplicado por 15
info
Grupo: Herói
Registrado: 07/03/16
Posts: 1.4k
Reputação: +385
Gênero: Masculino

Função matematica de porcentagem:
Citar(Valor/100)*percentual
Quanto vale 1% = valor divido por 100
Valor de 15% = quanto vale 1% multiplicado por 15
info
Grupo: Visconde
Registrado: 26/04/08
Posts: 251
Reputação: +36
Gênero: Masculino
Char no Tibia: Senhor Mithril

Bom, eu queria que adaptasse esse script para só ativar a magia se tiver com 10% de vida ou menos, só isso.
info
Grupo: Herói
Registrado: 07/03/16
Posts: 1.4k
Reputação: +385
Gênero: Masculino

Troca isso:
Citarif getCreatureHealth(cid) < 100 then
Por isso:
Citarif (getCreatureMaxHealth(cid)/100)*10 >= getCreatureHealth(cid) then
info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit

local magia = "Magic Shield" local storage = 55695 function onStatsChange(cid, attacker, type, combat, value) local calc = (getCreatureMaxHealth(cid) / 100) * 10 if isPlayer(cid) then if getPlayerStorageValue(cid, storage) == 1 then if combat ~= COMBAT_HEALING then if getCreatureHealth(cid) <= calc then doCreatureCastSpell(cid, magia) end end end end return trueend
info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit

local magia = "Magic Shield" local storage = 55695 function onStatsChange(cid, attacker, type, combat, value) local calc = (getCreatureMaxHealth(cid) / 100) * 10 if isPlayer(cid) then if getPlayerStorageValue(cid, storage) == 1 then if combat ~= COMBAT_HEALING then if getCreatureHealth(cid) <= calc then doCreatureCastSpell(cid, magia) end end end end return trueend
info
Grupo: Visconde
Registrado: 26/04/08
Posts: 251
Reputação: +36
Gênero: Masculino
Char no Tibia: Senhor Mithril
Olá, a todos, eu tenho esse script aqui por creaturescripts, gostaria de pedir um pequeno favor, que seria trocar essa condição que só usa quando tiver menos de 100 de vida, gostaria pedir para me colocarem a condição se o jogador tiver 10% de vida, ao invéz de 100 de vida, só isso, agradeço pela atenção!.
Segue abaixo o script