I'm working on a defense entity that slows players movement on touch for example 5 seconds. Here's what i got so far:
function ENT:Touch( ply )
if self:GetPower() >= 900 and v:IsPlayer() and v:Alive() and Owner:IsEnemy(v) then
ply:SetPlayerSpeed (40, 40)
end
end
I know the timer.Create is most likely what'll be used here, just not sure how to ring that into this function properly. Any help would be much appreciated!
you just create a simple timer in the ENT:Touch( ) function that fires after 5 seconds that calls a function setting the players speed back to how it was before
One issue I could see with this is the touch function is called every tick so if the player is on the panel for more than one tick it will create more than one timer. You also need to make sure to use an IsValid check in a timer when dealing with an entity. Would the player be able to run into more than one of these at any given time? Because if so you would want your timer solution to stack on the player across entities.
Add annother bool that defines weather or not the player has been slowed already or not
Sorry, you need to Log In to post a reply to this thread.