Looping a Sequence?

[lua]self:SetSequence(“my_sequence”,0.5)
self:SetPlaybackRate(1) [/lua]
For a nexbot, how do I loop a sequence?
My sequence plays once then freezes.
I’ve used this but I can’t find any info.
Probably obvious, but not for me.
Edit
If there is a better way please let me know, the below isn’t perfect and leads to “okay” results.
My solution was to reset the sequence with a timer, right when it ends.
[lua]timer.Create( “my_timer”, 11, 0, function()
self:ResetSequence(“my_sequence”)
end )[/lua]

Bump

If you turn off automatic frame advance, you can do it yourself clientside.


function ENT:Draw( )
  self:DrawModel( )

  if self:GetCycle( ) == 1 then
    self:SetCycle( 0 )
  else
    self:FrameAdvance( FrameTime( ) )
  end
end

As long as nextbots call :Draw clientside, that should work.

Originally, my timer wouldn’t always work. It would play the animation, stop playing it and wait for the timer to come around again, then it played once more. But with the code you gave me, it seems to work better, thanks. I added one other line (can’t remember what it was) but I’ll bet that wasn’t the fix.

This worked, but any idea why spawning the multiple nexbots makes the older ones stop looping the animation?
For instance, if I had 3 citizens walking, the first 2 spawned would stop the animation loop but the latest spawned one would loop.:suicide:

Didn’t know this, thanks

Anybody?

The easiest way I can think of is extracting your model and adding the word loop to the animation.

Example:



$sequence "idle" "anims\idle.smd" {
	"ACT_VM_IDLE" 1
	loop
}


He’s using default citizen models

Not really, I was just using that as an example. Basically the animations won’t continue to loop if another of that NPC is created.

So any other ideas guys? :open_mouth:

?

I just waited a week so I am going to bump again,

I dont think anyone knows, considering there have been no other answers in 3 weeks

What Kogitsune posted should work.
I used a similar method for my cat npcs.

Make your own animation system like I did. But I will tell you this: It takes a long time to make one, and also I suggest using modules

I pasted his code into my cl_init.lua, no changes in anything :blush: