• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

aura reflect

vagnerz1k

New Member
Joined
Nov 5, 2014
Messages
35
Reaction score
0
Hello guys I ask your help so that when the player have a storage it receives a new aura. What would this aura?
The aura is as follows when the player is attacked reflects 20% of the damage received by more ...
ps: I have seen several more so the version you use scripts did not work
TFS 0.3.1
 
Last edited:
Can you help me tried to do the script but did not work
here it is
note: does not have any error in time to test
Code:
function onStatsChange(cid, attacker, type, combat, value)
    if (getCreatureStorage(cid, 2000) and type == STATSCHANGE_HEALTHLOSS) then
        local absorb = math.ceil(value * 0.2)
        doSendMagicEffect(getThingPosition(attacker), CONST_ME_HOLYDAMAGE)
        doSendAnimatedText(getThingPosition(attacker), absorb, COLOR_RED)
        doCreatureAddHealth(attacker, -absorb)
        doCreatureAddHealth(cid, absorb)
    end
    return TRUE
end

@up
 
Last edited by a moderator:
Code:
if (getCreatureStorage(cid, 2000) and type == STATSCHANGE_HEALTHLOSS) then

What is the storage supposed to return?
 
I'm terrible with script but if the player has that storage it takes a hit for example 100 and 20 percent of the damage back to the player who attacked him.
 
I changed the script a bit and it worked but with errors on distro
the details that have to pass is the player needs a storage in order to reflect the damage from the amount to be reflected is 20% and here is the error

function onStatsChange(cid, attacker, type, combat, value)

if (getCreatureStorage(cid, 2000) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS)) then
return true
end

local absorb = math.ceil(value * 0.2)
doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYDAMAGE)
doSendAnimatedText(getThingPos(cid), absorb, COLOR_RED)
doCreatureAddHealth(attacker, -absorb)
doCreatureAddHealth(cid, absorb)
return true
end
 
where am I thinking?
here the error

[25/04/2015 19:00:21] Lua Script Error: [CreatureScript Interface]
[25/04/2015 19:00:21] data/creaturescripts/scripts/reflect.lua:onStatsChange

[25/04/2015 19:00:21] luaDoCreatureAddHealth(). Creature not found
[25/04/2015 19:00:21] [Error - CreatureEvent::executeOnStatsChange] Call stack overflow.
 
Code:
function onStatsChange(cid, attacker, type, combat, value)

     if isCreature(attacker) == TRUE and getCreatureStorage(cid, 2000) > 0 and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) then
         local absorb = math.ceil(value * 0.2)
         doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYDAMAGE)
         doSendAnimatedText(getThingPos(cid), absorb, COLOR_RED)
         doCreatureAddHealth(attacker, -absorb)
         doCreatureAddHealth(cid, absorb)
     end
     return TRUE
end
 
Last edited:
Can you give details about what happens? Try to avoid giving a description such as "not work" since it lacks information about the problem.
 
the loose script but the effect is not reflecting the damage and when you use rune it loose like a damage in itself does not decrease more life
 
Back
Top