• 3D2D Text Won't work for me :/ What on earth am I doing wrong?
    3 replies, posted
Hey guys so I am trying to make text that rotates depending on where you look, if that makes any sense. I just want the text appear when you look at the ent npc_dealer. However, I got most of it but it won't show when I look at the NPC Dealer. Keep in mind the code is in the cl_init.lua of the entity npc_dealer. [code] function ENT:Draw() self:DrawModel() local Pos = self:GetPos() local Eye1 = EyeAngles() local Ang = Angle(0, Eye1.y, 0) surface.SetFont("HUDNumber5") local text = "Cheese Wheels " local TextWidth = surface.GetTextSize(text) local width = ((TextWidth+10)/100) Ang:RotateAroundAxis(Ang:Up(), 90) Ang:RotateAroundAxis(Ang:Forward(), 100) Ang:RotateAroundAxis(Ang:Right(), 180) local TextAng = Ang if LocalPlayer():GetPos():Distance(self:GetPos()) < self:GetNWInt("distance") then cam.Start3D2D(Pos+Ang:Up()*60+Ang:Right()*-60, Ang, 0.13) draw.RoundedBox( 0, -TextWidth*0.5 , -1, width, 37, Color(25,25,25,170) ) draw.RoundedBox( 0, -TextWidth*0.5 +1, 0, TextWidth+8, 35, Color(0,0,0,170) ) draw.SimpleTextOutlined( text, "HUDNumber5", -TextWidth*0.5 + 5, 0, Color(255,255,255,255), 0, 0, 1, Color(0,0,0) ) cam.End3D2D() end end [/code] ALL HELP AND SUGGESTIONS ARE VERY APPRECIATED, THANK YOU FOR YOUR TIME! :>
what is most likely happening is that the thing works, but the angle is facing away from you at all times, so you can't actually see it.
Unless it was changed, SNPCs ( things that derive from base_ai ) don't call ENT:Draw. What type of entity is this?
[QUOTE=Kogitsune;48919910]Unless it was changed, SNPCs ( things that derive from base_ai ) don't call ENT:Draw. What type of entity is this?[/QUOTE] The base is base_ai.. What should I do then? D: [CODE] ENT.Base = "base_ai" -- This entity is based on "base_ai" ENT.Type = "ai" -- What type of entity is it, in this case, it's an AI. ENT.AutomaticFrameAdvance = true -- This entity will animate itself. function ENT:SetAutomaticFrameAdvance( bUsingAnim ) -- This is called by the game to tell the entity if it should animate itself. self.AutomaticFrameAdvance = bUsingAnim end [/CODE]
Sorry, you need to Log In to post a reply to this thread.