So, I've been trying to figure out how to set a Draw Distance for the text above my NPC's head.
This is what I've got so far, but it's not really working very well.
Note: I ripped the Draw Distance code from Sammy's text screen to see if it would work.
local render_convar_range2 = CreateClientConVar("ent_render_range", 1, true, false, "Determines the render range for NPCs. Default 1500")
local render_range2 = render_convar_range2:GetInt() * render_convar_range2:GetInt()
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
local plyShootPos, eye, Pos, Ang, text
function ENT:DrawTranslucent()
self:DrawModel()
text = SH_ACC.Language.accessory_vendor
eye = LocalPlayer():EyeAngles()
Pos = self:LocalToWorld( self:OBBCenter() )+Vector( 0, 0, 55 )
Ang = Angle( 0, eye.y - 90, 90 )
plyShootPos = LocalPlayer():GetShootPos()
if self:GetPos():DistToSqr(plyShootPos) < render_range2 then
cam.Start3D2D(Pos + Vector( 0, 0, math.sin( CurTime() ) * 2 ), Ang, 0.25)
draw.RoundedBox(4, -60, -15, 120, 30, Color(0, 119, 255, 175))
draw.SimpleText( TitleStore.Config.NPCText, "titleNPC2", 0, 0, color_white, 1, 1 )
draw.SimpleText( "Purchase Equipables", "secNPC2", 0, 35, color_white, 1, 1 )
cam.End3D2D()
end
end
try to use LocalPlayer():GetPos() instead of GetShootPos()
Just tried that, and it still doesn't work.
maybe theres something wrong with the convar, try to hardcode it
Thank you, I never really thought about it giving me an issue but that was the reason!
Sorry, you need to Log In to post a reply to this thread.