• added a chat bubble
    7 replies, posted
How would i add a floating chat bubble over my npc entity?
You would need to create the chat bubble as an entity, and when that is done, you add something like this into your NPC code: [lua] local bubble = ents.Create("ChattBubble") bubble:SetPos( self:GetPos() + (self:GetUp() * 90) ) bubble:SetParent( self ) bubble:SetAngles( self:GetAngles() ) bubble:Spawn() bubble:SetCollisionGroup(COLLISION_GROUP_WORLD)[/lua] If there is anything else I or Facepunch can help you with, please say so.
[QUOTE=wakeboarderCWB;28657787]You would need to create the chat bubble as an entity, and when that is done, you add something like this into your NPC code: [lua] local bubble = ents.Create("ChattBubble") bubble:SetPos( self:GetPos() + (self:GetUp() * 90) ) bubble:SetParent( self ) bubble:SetAngles( self:GetAngles() ) bubble:Spawn() bubble:SetCollisionGroup(COLLISION_GROUP_WORLD)[/lua] If there is anything else I or Facepunch can help you with, please say so.[/QUOTE] Ok i have the entity but where do i place the chat bubble code?
[QUOTE=leet frog;28658542]Ok i have the entity but where do i place the chat bubble code?[/QUOTE] Is your NPC created in entities/entities folder? Or, if you're making a gamemode, is it in a gamemode file? You would add it in the same code that the NPC is.
-snip
[QUOTE=wakeboarderCWB;28658936]Is your NPC created in entities/entities folder? Or, if you're making a gamemode, is it in a gamemode file? You would add it in the same code that the NPC is.[/QUOTE] yea but theres 3 files. cl_init.lua init.lua and shared.lua
In [b]init.lua[/b] or inside [lua]if SERVER then -- Here end[/lua] in [b]shared.lua[/b]
[QUOTE=Thermadyle;28665714]In [b]init.lua[/b] or inside [lua]if SERVER then -- Here end[/lua] in [b]shared.lua[/b][/QUOTE] so i put [lua] if SERVER then local bubble = ents.Create("ChattBubble") bubble:SetPos( self:GetPos() + (self:GetUp() * 90) ) bubble:SetParent( self ) bubble:SetAngles( self:GetAngles() ) bubble:Spawn() bubble:SetCollisionGroup(COLLISION_GROUP_WORLD) end [/lua] in my shared file?
Sorry, you need to Log In to post a reply to this thread.