• Gravity Generators
    0 replies, posted
Hey its me again. Im thinking about making a gravity generator... by far i got it to work but i dont like the method i use and thinking about using a math.Clamp reverse or Lerp reversing? Here is my code: ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "Generator: Gravity" ENT.Category = "Generators" ENT.Author = "Sodaki" ENT.EntHealth = 20 --How much Health the thingy have (4 pistol shots) function ENT:SetupDataTables() self:NetworkVar("Float", 0, "EntHealth") if SERVER then self:NetworkVarNotify("EntHealth", self.OnHealthChanged) end end function ENT:OnHealthChanged(name, old, new) for k,v in ipairs (player.GetAll()) do if(new >= 20) then v:SetGravity(1) elseif (new <= 10) then v:SetGravity(.5) end end end  function ENT:OnTakeDamage(dmg) self:SetEntHealth( self:GetEntHealth() - dmg:GetDamage())  end so you can see if the health is under equals 10 it changes the gravity by half.. for the players on the server.. but what i try is to make it more smooth so i mean he calcs the health and make it like the normal three sets.. for p.e. health = gravity 100 = 1 1(maybe 0) = 0.1 and i guess i need a calc function or use lerp but idk the working of lerp.. or is there any better function that i can use?
Sorry, you need to Log In to post a reply to this thread.