reduzir daños em OnStatsChange tfs 0.4

Bennyhappy
em Scripts

Bennyhappy

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 10/11/11Posts: 118
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(cid) and isPlayer(attacker) and type == STATSCHANGE_HEALTHLOSS then
value = value - 10
doTargetCombatHealth(attacker, cid, combat, -value, -value, type)
end
return true
end
e reduzir os danos para os jogadores?
que pode ser reduzida através de elementos?

 


bump

dalvorsn

õ/
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 21/12/11Posts: 750Gênero: Masculino

tu tem uma opção de fazer por script a redução do dano e dar return false, dai é cancelado o que seria feito pelas sources e vale apenas o que tu fez no script

"A covardia coloca a questão: É seguro? O comodismo coloca a questão: É popular? A etiqueta coloca a questão: é elegante? Mas a consciência coloca a questão, É correto? E chega uma altura em que temos de tomar uma posição que não é segura, não é elegante, não é popular, mas o temos de fazer porque a nossa consciência nos diz que é essa a atitude correta."

(Martin Luther King)

Bennyhappy

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 10/11/11Posts: 118

tu tem uma opção de fazer por script a redução do dano e dar return false, dai é cancelado o que seria feito pelas sources e vale apenas o que tu fez no script

sim no e posible, agora estoy mudando para reflection:

function onStatsChange(cid, attacker, type, combat, value) 
if isPlayer(cid) and type == STATSCHANGE_HEALTHLOSS then
if isPlayer(attacker) or isMonster(attacker) then

if combat == COMBAT_ICEDAMAGE then
absorb = math.floor(value / 2)
doSendMagicEffect(getThingPosition(attacker), CONST_ME_ICEATTACK)
doCreatureAddHealth(attacker, -absorb)
doSendAnimatedText(getThingPosition(attacker), absorb, COLOR_TEAL)
end

if combat == COMBAT_EARTHDAMAGE then
absorb = math.floor(value / 2)
doSendMagicEffect(getThingPosition(attacker), CONST_ME_GREEN_RINGS)
doCreatureAddHealth(attacker, -absorb)
doSendAnimatedText(getThingPosition(attacker), absorb, COLOR_LIGHTGREEN)
end



end
return true
end
end
itemHEAD = getPlayerSlotItem(cid, CONST_SLOT_HEAD)
itemARMOR = getPlayerSlotItem(cid, CONST_SLOT_ARMOR)
itemLEGS = getPlayerSlotItem(cid, CONST_SLOT_LEGS)
itemFEET = getPlayerSlotItem(cid, CONST_SLOT_FEET)
itemLEFT = getPlayerSlotItem(cid, CONST_SLOT_LEFT)
itemRIGHT = getPlayerSlotItem(cid, CONST_SLOT_RIGHT)
getItemAttribute(itemHEAD.uid, "EnergyProtec")
getItemAttribute(itemHEAD.uid, "FireProtec")
getItemAttribute(itemHEAD.uid, "IceProtec")
getItemAttribute(itemHEAD.uid, "PhysicalProtec")
getItemAttribute(itemHEAD.uid, "DeathProtec")
getItemAttribute(itemHEAD.uid, "EarthProtec")
getItemAttribute(itemHEAD.uid, "HolyProtec")
estoy tentando fazer sume todos os attrubutes em todos los slots para sacar % do reflection by damage xD u can helpme?

Bennyhappy

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 10/11/11Posts: 118

bump

akira021

Sky's Heart
avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 10/08/08Posts: 127

No final dar um Return False que o dano cancelado e dentro da função vc tira quanto de dano quer que o player leve, lembrando que o Value retorna o valor do dano que o Player vai sofrer, é só vc criar a redução de dano baseando-se no Value.

flug.png