Bloodlust Help

I’m trying to make it so, whenever you activate this “Feat” called “Bloodlust”, you’ll take 1 damage every second you’re out of combat, and stop when you reach 1 HP.

Now I don’t know what the problem is here but I can see its effects, I can activate this feat but whenever I activate it, no damage appears to be done any second, the game doesn’t report any errors.

If anyone can give me advice or a fix on this solution, that would be great.


function LustBlood()
    for k,v in pairs(player.GetAll()) do
    if player.GetByID(i).bloodlust == 1 && player.GetByID(i).prevAttackTime >= CurTime() && player.GetByID(i).Health > 1 then
        AddDamage(1)
        SetAttacker(player.GetByID(i))
        player.GetByID(i).prevAttackTime = CurTime() + 1
    end
    end
end
hook.Add("Think","LustBlood",LustBlood)

function Feat_Bloodlust(ply)
    if ply.bloodlust != 1 then
        ply.prevAttackTime = CurTime() + 5
        ply.bloodlust = 1
        Msg(tostring(ply).." is now a bloodthirsty maniac.
")
    else
        ply.bloodlust = 0
        Msg(tostring(ply).." is no longer a bloodthirsty maniac.
")
    end
end
concommand.Add("FeatsBloodlust",Feat_Bloodlust)

function GetPrevDamage(ply, inflictor, attacker, amount, dmginfo)
    if ply.bloodlust == 1 && dmginfo:GetAttacker() != ply then
        ply.prevAttackTime = CurTime() + 5 // Post-pone bloodlust damage.
    end
end
hook.Add("EntityTakeDamage","GetBloodlust",GetPrevDamage)

Solved it myself, renamed it, and expanded on the whole idea.

Masochist - Lets get this out of the way, you just love pain, you love to inflict it and you love to be struck with it, your health will drain when not in battle, and will be regained by inflicting pain on another. If you get hurt before you could hurt another, the damage drained is lost permanently.

[lua]function LustBlood()
local Players = player.GetAll()
for i =1, table.Count (Players) do
local ply = Players*
if (ply.bloodlust == 1 && ply.prevAttackTime <= CurTime() && ply:Health() > 1) then
ply:SetHealth(ply:Health() - 1)
ply.prevAttackTime = CurTime() + 1
ply.mas_losthealth = ply.mas_losthealth + 1
end
end
end
hook.Add(“Think”,“LustBlood”,LustBlood)

function Attribute_Masochist(ply)
if ply.bloodlust != 1 then
ply.prevAttackTime = CurTime() + 5
ply.bloodlust = 1
ply.mas_losthealth = 0
Msg(tostring(ply)…" is now a masochist
“)
else
ply.bloodlust = 0
Msg(tostring(ply)…” is no longer a masochist
")
ply.mas_losthealth = 0
end
end
concommand.Add(“Attribute_masochist”,Attribute_Masochist)

function GetPrevDamage(victim, inflictor, attacker, amount, dmginfo)
if ( victim:IsPlayer() && victim.bloodlust == 1 ) then
victim.mas_losthealth = 0
victim.prevAttackTime = CurTime() + 5
end
if ( attacker:IsPlayer() && attacker.bloodlust == 1 ) then
attacker:SetHealth(attacker:Health() + attacker.mas_losthealth)
attacker.mas_losthealth = 0
attacker.prevAttackTime = CurTime() + 5
end
end[/lua]
hook.Add(“EntityTakeDamage”,“GetPrevDamage”,GetPrevDamage)Thanks for trying atleast. :ms:

I’ll try Ragged next.

Ragged - Damage is reduced by 1/4th, but damage is continuous.