reepblue Posted January 28, 2018 Share Posted January 28, 2018 I've uploaded the needed files to replicate this bug. If you press "T", the model will do it's attacking animation but the test function will fire as soon as you press "T", and not after the animation is done. Watch "Done!" pop up in the log in the script editor as soon as the animation starts! endhookbug.zip Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted January 28, 2018 Share Posted January 28, 2018 Here is the correct method to use: function Script:testend() System:Print("Done!") end function Script:Draw() if window:KeyHit(Key.T) then self.entity:PlayAnimation("attack0",0.03,300,1,"testend") end end You were actually calling the function and passing the result (nil) as a function parameter. The function EndAnimation() will always be called if it is present, so you can just do this: function Script:EndAnimation(sequence) System:Print("Done!") end function Script:Draw() if window:KeyHit(Key.T) then self.entity:PlayAnimation("attack0",0.03,300,1) end end This is the recommended method. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted January 28, 2018 Author Share Posted January 28, 2018 From the documentation, it makes it like you can call specific functions after each animation. Working now, gotta make some adjustments though. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted January 28, 2018 Share Posted January 28, 2018 1 minute ago, reepblue said: From the documentation, it makes it like you can call specific functions after each animation. Working now, gotta make some adjustments though. You can! But this is really just there for backwards compatibility. I should probably remove that from the docs and just leave it in silently. EndAnimation can receive an integer argument for the current sequence. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted January 28, 2018 Author Share Posted January 28, 2018 Ahh, did not see your edited post. Mind posting that snip on the documentation page then so no one else looks like an idiot? Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted January 28, 2018 Share Posted January 28, 2018 function Script:EndAnimation(sequence) System:Print("Done!") end Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted January 29, 2018 Share Posted January 29, 2018 I added this into the script template that is used when you create a new script. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted January 29, 2018 Author Share Posted January 29, 2018 Thanks, should clear things up. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
tipforeveryone Posted May 15, 2018 Share Posted May 15, 2018 On 1/29/2018 at 5:25 AM, Josh said: function Script:EndAnimation(sequence) System:Print("Done!") end This is still not in document, is it unofficial or you forgot to add it ? @Josh 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted June 6, 2018 Share Posted June 6, 2018 Added now, thank you. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.