[lua]
function ENT:OnRemove()
if self.InfoBubble then
self.InfoBubble:Remove()
end
end
ENT.InfoBubbleCreated = false
function ENT:Think()
if self.InfoBubbleCreated == false then
self.InfoBubble = ClientsideModel("models/extras/info_speech.mdl", RENDERGROUP_OPAQUE)
local pos = self:GetPos()
pos.z = pos.z + 80
self.InfoBubble:SetPos(pos)
self.InfoBubble:SetMoveType(MOVETYPE_NONE)
self.InfoBubble:Spawn()
self.InfoBubble:SetMoveType(MOVETYPE_NONE)
self.InfoBubbleCreated = true
else
local ang = self.InfoBubble:GetAngles()
self.InfoBubble:SetAngles(ang)
end
end
[/lua]
I've tried this, but it won't spawn the entity. I'm trying to make it spin above my entity, any ideas anybody?
Try getting rid of the second [I]SetMoveType()[/I] below [B]Spawn()[/B].
[lua]
function ENT:OnRemove()
if ValidEntity(self.InfoBubble) then
self.InfoBubble:Remove()
self.InfoBubble = nil
end
end
function ENT:Initialize()
self.InfoBubble = ClientsideModel("models/extras/info_speech.mdl", RENDERGROUP_OPAQUE)
local pos = self:GetPos() --This may be the problem. try self.Entity:GetPos()
pos.z = pos.z + 80
self.InfoBubble:SetPos(pos)
self.InfoBubble:SetMoveType(MOVETYPE_NONE)
self.InfoBubble:Spawn()
end
function ENT:Think()
local ang = self.InfoBubble:GetAngles()
self.InfoBubble:SetAngles(ang) --You are setting the angle of InfoBubble to the angle of InfoBubble. You need to revise this.
end
[/lua]
Also, if you plan on using the entities menu to spawn it, you need this.
[lua]
function ENT:SpawnFunction( ply, tr )
if ( !tr.Hit ) then return end
local ent = ents.Create( self.Classname )
ent:SetPos( tr.HitPos + tr.HitNormal * 16 )
ent:Spawn()
ent:Activate()
return ent
end
[/lua]
Sorry, you need to Log In to post a reply to this thread.