Fireandthethud Posted May 29, 2016 Share Posted May 29, 2016 (edited) 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 May 29, 2016 by Fireandthethud Link to comment https://forums.kleientertainment.com/forums/topic/67734-stategraphs-is-it-possible-to-start-an-animation-on-a-frame-number-greater-than-1/ Share on other sites More sharing options...
Mobbstar Posted May 29, 2016 Share Posted May 29, 2016 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. Link to comment https://forums.kleientertainment.com/forums/topic/67734-stategraphs-is-it-possible-to-start-an-animation-on-a-frame-number-greater-than-1/#findComment-777831 Share on other sites More sharing options...
Fireandthethud Posted May 29, 2016 Author Share Posted May 29, 2016 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 :\ Link to comment https://forums.kleientertainment.com/forums/topic/67734-stategraphs-is-it-possible-to-start-an-animation-on-a-frame-number-greater-than-1/#findComment-777843 Share on other sites More sharing options...
Mobbstar Posted May 29, 2016 Share Posted May 29, 2016 from "crop" component: self.inst.AnimState:SetPercent("grow", self.growthpercent) Whereas "grow" is the animation and self.growthpercent is a value between 0 and 1. Link to comment https://forums.kleientertainment.com/forums/topic/67734-stategraphs-is-it-possible-to-start-an-animation-on-a-frame-number-greater-than-1/#findComment-777847 Share on other sites More sharing options...
Fireandthethud Posted May 29, 2016 Author Share Posted May 29, 2016 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! Link to comment https://forums.kleientertainment.com/forums/topic/67734-stategraphs-is-it-possible-to-start-an-animation-on-a-frame-number-greater-than-1/#findComment-777873 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now