I'm making this entity that i want to resize when it spawns. I get no errors at all.
[code]
function ENT:Initialize()
self.Entity:SetModelScale( self.Entity:GetModelScale() * 5.25, 1 )
self.Entity:SetModel("models/props_c17/FurnitureTable001a.mdl")
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
local phys = self.Entity:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
end
[/code]
This should help:
[code]
local scale = Vector( 1,1,4 )
local mat = Matrix()
mat:Scale( scale )
prop:EnableMatrix( "RenderMultiply", mat )
[/code]
I think setting model scale before setting model itself isn't the best idea.
[QUOTE=dingusnin;44580723]This should help:
[code]
local scale = Vector( 1,1,4 )
local mat = Matrix()
mat:Scale( scale )
prop:EnableMatrix( "RenderMultiply", mat )
[/code][/QUOTE]
Keep getting this error:
[code]
[ERROR] lua/entities/poker_table/init.lua:57: attempt to call method 'EnableMatrix' (a nil value)
1. unknown - lua/entities/poker_table/init.lua:57
[/code]
My code:
[code]
function ENT:Touch(ent)
local scale = Vector( 1,1,4 )
local mat = Matrix()
mat:Scale( scale )
ent:EnableMatrix( "RenderMultiply", mat )
end
[/code]
Any ideas?
This worked excellent for me:
[lua]
local ent = ents.Create("prop_dynamic")
ent:SetModel(d.model)
ent:SetAngles(Angle(0,math.random(0,360),0))
ent:SetPos(hit + Vector(0,0,d.scale[2]))
ent:SetModelScale( math.random(math.Clamp((1-x)+1,0.1,100),x), 0 );
[/lua]
[QUOTE=SkitZz;44580823]Keep getting this error:
[code]
[ERROR] lua/entities/poker_table/init.lua:57: attempt to call method 'EnableMatrix' (a nil value)
1. unknown - lua/entities/poker_table/init.lua:57
[/code]
My code:
[code]
function ENT:Touch(ent)
local scale = Vector( 1,1,4 )
local mat = Matrix()
mat:Scale( scale )
ent:EnableMatrix( "RenderMultiply", mat )
end
[/code]
Any ideas?[/QUOTE]
[del]ent is nil. Add IsValid( ent ) check.[/del]
[QUOTE=Robotboy655;44580926]ent is nil. Add IsValid( ent ) check.[/QUOTE]
Would it not be that ENT:Touch is called serverside, and EnableMatrix is a Clientside funciton?
(Unless I am completely wrong, in which case ignore me)
[QUOTE=dingusnin;44580970]Would it not be that ENT:Touch is called serverside, and EnableMatrix is a Clientside funciton?
(Unless I am completely wrong, in which case ignore me)[/QUOTE]
You are correct.
[QUOTE=dingusnin;44580970]Would it not be that ENT:Touch is called serverside, and EnableMatrix is a Clientside funciton?
(Unless I am completely wrong, in which case ignore me)[/QUOTE]
You were right (I'm a retard)
[url]http://puu.sh/8dVqd.jpg[/url]
Sorry, you need to Log In to post a reply to this thread.