Hi there, i am trying to make a scripted entity that animates, I have already made the model and sequence and it works fine in-game when i make a prop_dynamic in hammer and set the default sequence to spin (the sequence i want to play). but I cannot get it to animate when I spawn it as a SENT, it just sits there doing nothing. - here is my source code, id really appreciate it if someone could point me in the right direction :)
(btw, the sequence number i want is 1)
INIT.LUA
AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside
AddCSLuaFile( "shared.lua" ) -- and shared scripts are sent.
include('shared.lua')
function ENT:Initialize()
self:SetModel( "models/loz/Atompickup.mdl" )
self:SetSolid( SOLID_BBOX )
--self:PhysicsInit( SOLID_VPHYSICS ) -- Make us work with physics,
--self:SetMoveType( MOVETYPE_VPHYSICS ) -- after all, gmod is a physics
--self:SetSolid( SOLID_VPHYSICS ) -- Toolbox
--local sequence = self:LookupSequence("spin")
-- self:SetCycle( 5 )
self:SetSequence(1)
--self.AutomaticFrameAdvance = true
self:SetTrigger( true )
--self:GetPhysicsObject():EnableMotion( true )
self:PhysWake( )
self:SetNotSolid( true )
Glow = ents.Create("env_sprite")
Glow:SetKeyValue("model","orangecore2.vmt")
Glow:SetKeyValue("rendercolor","0 200 200")
Glow:SetKeyValue("scale","1")
Glow:SetPos(self.Entity:GetPos())
Glow:SetParent(self.Entity)
Glow:Spawn()
Glow:Activate()
end
function ENT:StartTouch( ent )
if ( ent:IsValid() and ent:IsPlayer() ) then
self:Remove()
umsg.Start( "serverattackdata" );
umsg.String( self:GetModel() );
umsg.String( ent:GetName() );
umsg.String( "50points" );
umsg.End();
ent:PrintMessage( HUD_PRINTCENTER, "+50 XP" )
end
end
function ENT:Use( activator, caller )
return
end
function ENT:Think()
end
CL_INIT.lua
include('shared.lua')
--[[---------------------------------------------------------
Name: Draw
Purpose: Draw the model in-game.
Remember, the things you render first will be underneath!
---------------------------------------------------------]]
function ENT:Draw()
--self.BaseClass.Draw(self) -- We want to override rendering, so don't call baseclass.
-- Use this when you need to add to the rendering.
--self:DrawEntityOutline( 1.0 ) -- Draw an outline of 1 world unit.
self:DrawModel() -- Draw the model.
-- AddWorldTip( self:EntIndex(), "BATHTUB TIME!", 0.5, self:GetPos(), self ) -- Add an example tip.
end
SHARED.lua
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "50Points"
ENT.Author = "2sneaky"
ENT.Contact = "Don't"
ENT.Purpose = "SURF"
ENT.Instructions = "SURF"
ENT.AutomaticFrameAdvance = true
Sorry, you need to Log In to post a reply to this thread.