local reduction = 70 --this means that the damage is reduced by 70%
function onStatsChange(target, attacker, type, combat, value)
if isCreature(attacker) and isPlayer(target)
return false,doCreatureAddHealth(target,-value*(1-(reduction/100))), doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT, getCreatureName(attacker).. " dealt " ..value*(1-(reduction/100)).. " damage to you!")
end
return true
end
local reduction = 70 --70% reduction
function onStatsChange(target, attacker, type, combat, value)
value = value * (1-(reduction/100))
return true
[14/02/2012 16:03:11] [Error - CreatureScript Interface]
[14/02/2012 16:03:11] data/creaturescripts/scripts/ld.lua:onStatsChange
[14/02/2012 16:03:11] Description:
[14/02/2012 16:03:11] (luaDoPlayerSendTextMessage) Player not found
[14/02/2012 16:18:28] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/ld.lua:4: ')' expected near 'LT'
[14/02/2012 16:18:28] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/ld.lua)
[14/02/2012 16:18:28] data/creaturescripts/scripts/ld.lua:4: ')' expected near 'LT'
local reduction = 70 --this means that the damage is reduced by 70%
local storage = 815870 --the storage value used
function onStatsChange(target, attacker, type, combat, value)
if isCreature(attacker) and isPlayer(target) and (type == 1 or type == 3) then
if getPlayerStorageValue(target,storage) ~= 1 then
return false,doCreatureAddHealth(target,-value*(1-(reduction/100))), doPlayerSendTextMessage(target,MESSAGE_EVENT_DEFAULT, getCreatureName(attacker).. " dealt " ..value*(1-(reduction/100)).. " damage to you!"),setPlayerStorageValue(target,storage,1)
else
setPlayerStorageValue(target,storage,0)
end
end
return true
end