• Effect error: Couldn't initialize effect!
    4 replies, posted
Hey, when i'm trying to use one of my effects here, I get this: [code] Error: Couldn't initialize effect! [/code] I can't find the problem because the error is so damn undescriptive (if garry is reading this, please make this more descriptive). My code is: Serverside: [lua] local effectdata = EffectData() effectdata:SetEntity( self.Target ) effectdata:SetOrigin( self.Target:WorldToLocal( TargetPos ) ) local muzzlepos = self:GetPos() + self:GetForward() * 5 effectdata:SetAttachment( self:EntIndex() ) effectdata:SetStart( self:WorldToLocal( muzzlepos ) ) effectdata:SetScale( 2 ) effectdata:SetMagnitude( 4 ) effectdata:SetRadius( 4 ) util.Effect( "supahbeam", effectdata ) [/lua] Clientside code (this looks a little ugly, but bear with me): [lua] local Ent = Entity( data:GetAttachment() ) local StartPos = data:GetStart() local Target = data:GetEntity() local AimPos = data:GetOrigin() local Time = data:GetScale() local SpriteSize = data:GetMagnitude() or 8 local BeamWidth = data:GetRadius() or 2 self.StartTime = CurTime() self.EndTime = CurTime() self.Duration = Time self.Ent = Ent self.Target = Target self.AimPos = AimPos self.StartPos = StartPos self.SpriteSize = SpriteSize self.SpritePos = Vector(0,0,0) --This will change later self.BeamWidth = BeamWidth self.OriginalModel = Ent:GetModel() [/lua] All help appreciated. No, I haven't searched, searching is disabled :(
So... where's the effect code?
The clientside bit I posted. It fails when it initializes, not when it renders, so I don't think (correct me if i'm wrong) there's any point posting that. I've thought maybe it's the entity being invalid, but i've checked it and it's fine.
I see, I'm guessing there's an error somewhere in the effect code then, since it doesn't seem to have been registered.
Yeah I think it was.. [code] local EFFECT = {} function EFFECT... [/code] I copied the effect from my WIP toybox weapon. This was leftover from my toybox code :downs:
Sorry, you need to Log In to post a reply to this thread.