edited October 2016 in ORK Scripting
Hello all,

I'm trying to build a custom script for player characters in a Grid battle system.

In my Combatant I assigned the Animation System Type to "Custom".
In the Base/Control-->Animations I have created a new animation for my player
in battle. I am using the Custom Settings only and I have created the custom Animation with Animation Type: Attack.

The Play function is "AttackPlay" and the Stop function is "AttackStop" both public functions in my script.

When I choose the "Attack" command in my battle my player performs the animation but the problem I am having is that this animation never ends!

I can see that ORK is calling my Play Function but I do not know why is not calling my Stop Function. I also do not get any errors in the console.

1) Should I call this function myself?
2) When is this function called?
3) Is it there any tutorial or how to that shows more about the Custom Animation? I could not find them myself.

Regards
Post edited by MikeMetal on
  • edited October 2016
    Hi,

    At the end I could solve this problem. This is what I did, just in case it can be useful for somebody else.



    /* For ORK to call this function it HAS TO be public and void*/
    public void AttackPlay(){
    anim.SetBool ("fire", true); // sets the condition to play the animation to true
    StartCoroutine(Attack()); // I start my co-routine here
    }

    /* Waits for some time and then stops the animation.*/
    public IEnumerator Attack(){
    yield return new WaitForSeconds(0.5F); // play the animation for 0.5 secs
    AttackStop(); // Stop playing the animation
    }

    /* Sets the condition to play the animation to false*/
    public void AttackStop(){
    anim.SetBool ("fire", false);
    }


    HIH

    Regards
    Post edited by MikeMetal on
  • edited October 2016
    As a further explanation - if you tell ORK to play the animation, it will only play it. If you want it to stop, this either needs to be handled by the animation system (which is the case in legacy/mecanim if you set it up to only play it once), or tell ORK to stop the animation.

    ORK wont automatically stop the animation, because it's only forwarding your play request to whatever animation system you're using. ORK doesn't know if the animation should only be played 1 time or repeated, etc. :)
    Post edited by gamingislove on
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!

  • Thanks so much for your answer GIL.

    But how do I tell ORK to stop the animation? This is what I do not know how to do, because although I have defined a method in the Stop Function, it is never called.

    Greetings

  • If you're using the Combatant Animation node to play an animation, there's also a Stop option to stop the animation. I.e. you'll use a 2nd node to stop the animation after some time.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.