How do I get the speed of an activity?

I’m just wondering, how would I go about getting the speed of an NPC/SNPC’s animation? (or the time in which it is predicted to end), as once my test SNPC has finished it’s animation, it will remain in that same position as in the last frame of the animation, by this point, it is pretty much inanimate.

I’m not using SetSequence(), I’m using a schedule with the “TASK_PLAY_SEQUENCE” task tied to it, here’s the code which activates the animation.

The reason I want to know the time is so that I can create a timer based on that duration which sets the SNPC’s activity to an idle activity when it is finished.


function ENT:SetNPCAnimation(ACT_,bReset)
	self:StopMoving()
	self:StopMoving()
	local nSched = __orbsched.New()
	nSched:EngTask("TASK_STOP_MOVING",0)
	if (bReset) then
		nSched:EngTask("TASK_RESET_ACTIVITY",0)
	end
	nSched:EngTask("TASK_PLAY_SEQUENCE",ACT_)
	self:StartSchedule(nSched)
end

(I will not be able to respond to any feedback immediately)

You should be able to use either SequenceDuration or GetPlaybackRate after the animation has started.