Ir para conteúdo

Featured Replies

Postado

Eae, galera. Queria pedir uma ajuda a vcs..

 

Estou com esse script de Reflect, mas gostaria que ele fosse por porcentagem. Agradeço desde-ja.

local config = { 
storage = 3411101,

function onStatsChange(cid, attacker, type, combat, value)
if value >= 1 and (type == STATSCHANGE_HEALTHLOSS or (getCreatureCondition(cid, CONDITION_MANASHIELD) and type == STATSCHANGE_MANALOSS))  then
if getPlayerStorageValue(cid,config.storage) == 1 and isCreature(attacker) then
doSendAnimatedText(getCreaturePosition(cid),"REFLECT   "..value, 215)
doSendAnimatedText(getCreaturePosition(attacker),"-"..value, 215)
doCreatureAddHealth(attacker, -value, true)
setPlayerStorageValue(cid,config.storage, 0)
return false
end
end
return true
end

Resolvido por Vodkart

Ir para solução
  • Respostas 7
  • Visualizações 743
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local config = { storage = 3411101, percent = 70 } math.percent = function (value, percentage) return math.ceil(math.floor(value)*math.floor(percentage)/100) end function onStatsChange(cid, attac

Posted Images

Postado

o que em porcentagem? o dano refletido ou a chance de dar reflect?

 

se for o dano, por exemplo...

 

Attacker deu 1000 de dano no Jogador.

 

então se a porcentagem for de 70% para dar o reflect, então o 

 

Attacker vai tomar 700 de dano(que foi refletido em 70%)

Jogador vai tomar só 300 de dano(aquele que foi atacado, ficando com os 30%)

 

É isso?

Postado
local config = { 
	storage = 3411101,
	percent = 70
} 
math.percent = function (value, percentage)
	return math.ceil(math.floor(value)*math.floor(percentage)/100)
end
function onStatsChange(cid, attacker, type, combat, value)
	if value >= 1 and (type == STATSCHANGE_HEALTHLOSS or (getCreatureCondition(cid, CONDITION_MANASHIELD) and type == STATSCHANGE_MANALOSS)) then
		if getPlayerStorageValue(cid,config.storage) == 1 and isCreature(attacker) then
			local atk, me = math.percent(value, config.percent), math.percent(value, (100 - config.percent)) -- aqui por exemplo vai devolver 70% do atack para o que atacou e 30% para mim
			doSendAnimatedText(getCreaturePosition(cid),"REFLECT "..atk, 215)
			doSendAnimatedText(getCreaturePosition(attacker),"-"..atk, 215)
			doTargetCombatHealth(cid, attacker, COMBAT_PHYSICALDAMAGE, -me, -me, CONST_ME_BLOCKHIT)
			doTargetCombatHealth(attacker, cid, COMBAT_PHYSICALDAMAGE, -atk, -atk, CONST_ME_BLOCKHIT)
			setPlayerStorageValue(cid,config.storage, 0)
			return false
		end
	end
	return true
end

 

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo