• My NPC is T-posed. Why?!
    2 replies, posted
I used a template first, but edited it a lot. Now it looks like this: [B][U]init.lua[/U][/B] [CODE] local model = "models/player/group01/male_01.mdl" -- What model should it be? local classname = "npc_policequestioner" -- This should be the name of the folder containing this file. local ShouldSetOwner = false -- Set the entity's owner? ------------------------------- AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include( 'shared.lua' ) ------------------------------- util.AddNetworkString( "policequestioner_use" ) -------------------- -- Spawn Function -- -------------------- function ENT:SpawnFunction( ply, tr ) if ( !tr.Hit ) then return end local SpawnPos = tr.HitPos + tr.HitNormal * 25 local ent = ents.Create( classname ) ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate() if ShouldSetOwner then ent.Owner = ply end return ent end ---------------- -- Initialize -- ---------------- function ENT:Initialize() self.Entity:SetModel( model ) self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) self:Activate() local phys = self.Entity:GetPhysicsObject() if (phys:IsValid()) then phys:Wake() end end ----------------- -- Take Damage -- ----------------- function ENT:OnTakeDamage( dmginfo ) end ------------ -- On use -- ------------ function ENT:Use( ply ) net.Start( "policequestioner_use" ) net.Send( ply ) end ----------- -- Think -- ----------- function ENT:Think() end ----------- -- Touch -- ----------- function ENT:Touch(ent) end -------------------- -- PhysicsCollide -- -------------------- function ENT:PhysicsCollide( data, physobj ) end [/CODE] [U][B]cl_init.lua[/B][/U] [CODE] include('shared.lua') function ENT:Initialize() self.Color = Color( 255, 255, 255, 255 ) end function ENT:Draw() --self:DrawEntityOutline( 1 ) self.Entity:DrawModel() end [/CODE] [B][U]shared.lua[/U][/B] [CODE] ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "NPC Police Questioner" ENT.Author = "Fillipuster" ENT.Category = "Fillipuster" ENT.Spawnable = true ENT.AdminSpawnable = true [/CODE] When I spawn the NPC (tried several ways) it just spawns in a T-pose. Have anyone got any idea, how to fix this?
you aren't setting his animation add this to shared.lua: [code]ENT.AutomaticFrameAdvance = true[/code] add this to init: [code] function ENT:Think() self:SetSequence(self:LookupSequence("idle_all_01")) -- this should be the right animation for player models (which you are using) end [/code] ResetSequence may be better but that's what I used for an idle animation on my npcs.
Didn't work. Btw, if this has any effect - I am running this on DarkRP 2.5.0
Sorry, you need to Log In to post a reply to this thread.