Jump to content

Recommended Posts

-- Deals poison damage.
local function DoPoisonDamage(inst)
inst.components.health:DoDelta(-1, true, "poison")

end

-- OnAttackOther, deal poison damage every .33 seconds.
local function onattackother(inst, data)
if data.target and data.target.components.health and not data.target.components.health:IsDead() then

-- No target players.
if not data.target:HasTag("player") then

-- Can't already be poisoned.
if data.target.poisontask == nil then

-- If conditions met; deal DoPoisonDamage value 3 times per second.
data.target.poisontask = data.target:DoPeriodicTask(1/3, DoPoisonDamage)

-- End poison damage @ 30 seconds. Deals 90 damage total.
data.target.poisonwearofftask = data.target:DoTaskInTime(30, function(inst) inst.poisontask:Cancel() inst.poisontask = nil end)
            end
        end
    end
end

Okay, so this simply is some poison code I've been testing thanks to a friend. It's not strong initially but can cause the player to deal over a hundred damage with their bare fists over time, plus weapons increase the initial damage. My main issue, however, is that you can't see that damage is being dealt. Is there any way to either make an enemy flash a pink-purple when they take a damage from this or make an enemy turn pink-purple shaded until the effect is over? Either one works, I just want to know that they're still taking damage. Is there any way that is somewhat easy to do this? I couldn't think of any and figured the forums would be a bit more help than trying to study it myself.

Thanks! Peace out.

Edited by NyctoDarkMatter
Added more comments into code.

Calling on @DarkXero if he knows the answer, or @Mobbstar since you guys are generally the most helpful. I just need a way to make the poison change their color; would there be a way, perhaps, to set a light on them with no radius or brightness, so that they just turn purple without glowing? If not, what do you guys recommend?

You could try this, each time it should do a tick of damage:

	data.target.AnimState:SetMultColour(1,0,1,1)
	data.target:DoTaskInTime(.3, function(inst) inst.AnimState:SetMultColour(1,1,1,1) end)

That should make the afflicted target blip purple for .3 seconds.

Could also look into using AnimState:SetAddColour in combination and changing the values around to get the exact color you want.

In your DoPoisonDamage function, so I suppose it would go like this:

local function DoPoisonDamage(inst)
	inst.components.health:DoDelta(-1, true, "poison")
	inst.AnimState:SetMultColour(1,0,1,1)
	inst:DoTaskInTime(.3, function(inst) inst.AnimState:SetMultColour(1,1,1,1) end)
end

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...