• SetModelScale and GetModelScale
    5 replies, posted
Hello I'm fairly new to Lua and trying to improve my knowledge by fixing up broken gamemode and learning new functions and I've hit a brick wall [Lua] function META:Grow() for _,ply in pairs(player.GetAll()) do if self:GetPos():Distance(ply:GetPos()) < 200 then if ply.Stank == nil then ply.Stank = {Level = 1,} else ply.Stank.Level = ply.Stank.Level + 1 end timer.Simple(math.random(10,30),function() if ply:IsValid() then ply:EmitScent() end end ) end end if self:GetModelScale().x < 10 then self:SetModelScale(self:GetModelScale() + Vector(.05,.05,.05)) timer.Simple(math.random(10,30),function() if self:IsValid() then self:Grow() end end ) end end [/Lua] Now I believe ive fixed the SetModelScale issue by putting this in the initial cl_init [Lua] function Entity:SetModelScale(scale) local mat = Matrix() mat:Scale(scale) self:EnableMatrix("RenderMultiply", mat) end [/Lua] But GetModelScale from what I've read now works completely different as well Any help would be appreciated Thanks Guys
What are you asking us to do?
Probably just want to do like [lua] function Entity:SetModelScale(scale) self.fModelScale = scale blablabla end function Entity:GetModelScale() return self.fModelScale or 1 end [/lua]
I was trying to find a replacement for GetModeScale. And Donkie that worked perfectly thanks! :D Mind explaining to me what that did? as I said I'm doing this to learn.
The arguments for SetModelScale have been changed. It no longer takes a vector, it takes two floats (I believe) SetModelScale(float Scale, float TimeToSize) The first float is what you wish to scale to (2 for 2x as large, .5 for 1/2 as large) and TimeToSize is the time it takes for the model to reach that size. Pros: Easier to use Cons: Cannot scale as easily on an individual axis Unsure about GetModelScale
[QUOTE=mib999;39157277]What are you asking us to do?[/QUOTE] please stop shitposting everywhere, you dont know lua anyways.
Sorry, you need to Log In to post a reply to this thread.