Jump to content

Recommended Posts

Hello, I'm wondering if anyone can help with a problem I'm having with this custom StateGraph I'm working on. The essence of the problem is that I want to use the ingame "jump" animation, but I need a snippet from the center of it so that my mod would look right. So far, I have figured out how to interrupt an animation on cue like this:

					 timeline = 
        {
            TimeEvent(num*FRAMES, function(inst) flypos(inst) end),

        },

This method has worked, stopping the animation on the frame number I want, but I'm having trouble figure out how I would start an animation somewhere other than frame one. So lets say if the animation is 25 frames long, how would I be able to pick a select few frames from it, say a range from 10-15, and play those? 

Edited by Fireandthethud

Out of curiosity, where do you have the interrupting code from? I can't find a function "flypos" in the game files.

Farm crops set their animstate to X% on the timeline of a specific animation. If you can't play from that point on somehow, maybe you can hack and repeatedly set the animation this way.

flypos() is my own function, because I have several states that should play the same animation, and I was experimenting with different animations to use. It's essentially a stand-in for this code: 

inst.sg:GoToState("fly")

where fly is one of the states in my SG.

Anywho, I tried looking for your suggestion, and I found this:

local function setfertilityfn(inst, fert_percent)
	
	local anim = "full"
	if fert_percent <= 0 then
		anim = "empty"
	elseif fert_percent <= .33 then
		anim = "med2"
	elseif fert_percent <= .66 then
		anim = "med1"
	end
	
	inst.AnimState:PlayAnimation(anim)
	
end

It looks as if some number is gradually increased, and a certain animation is played based on its value, instead of a frame that lands at x% of an animation's frames. If this is what you meant, I don't think this would work, as I am working with just one animation file :\

Okay so that worked for my purposes! I only really needed a single frame, and that worked fine. Perhaps with more messing around I can get multiple frames but as it stands, it works well enough! Thanks Mobbstar!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...