• Give NPC a name?
    5 replies, posted
[code] function ENT:OnTakeDamage(dmg) if( self:Health() <= 0 ) then self.inflictor = dmg:GetInflictor() gamemode.Call( "OnNPCKilled", self, dmg:GetAttacker(), self.inflictor ) end end [/code] Says "playername <weaponicon> #npc_classname" when I kill it. How to make it so that is say "playername <weaponicon> My named NPC"? Using self:SetName("My named NPC") does not help at all.
Im not sure were to start but i dont think you should be doing self. anything when self is not defined i do not think. Shouldnt it be self.Entity.Inflictor
[QUOTE=Science;29986832]Im not sure were to start but i dont think you should be doing self. anything when self is not defined i do not think. Shouldnt it be self.Entity.Inflictor[/QUOTE] self.Entity is depreciated, self is perfectly fine.
Most #variables have to do with [b][url=http://wiki.garrysmod.com/?title=Language.Add]Language.Add [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[lua]language.Add("npc_combine_s", "Combine Soldier")[/lua] I think its something like this.
Thank you. shared.lua [code] if CLIENT then language.Add("npc_thing", "My named NPC") end [/code]
Sorry, you need to Log In to post a reply to this thread.