Forum rules - please read before posting.

improvement: run when skipping option for animate action

sample:
I have have cutscene where the player says something "I will try on this hat"
then a mecanim animation action enables a hat he is wearing.
then he says "The color of this hat doesn't match my eyes."
then a mecanim animation action which removes the hat.


when I skip the cutscene while he says "The color ..." 
(skip via script : AC.KickStarter.actionListManager.EndCutscene ();)





then the mecanim animation which removes the hat isn't processed and the player 
now wears the hat forever.

It would be great if the could force the animations at the end of a cutscene that reset the state could be checked optionally like [x] run when skipping.

something for the time after 30th April :0)

Comments

  • Could it be handled by having the hat removed in a separate cutscene that runs after the cutscene?
  • Snebjorns is kinda right. I mean, we could have an "actionlist to run when this actionlist is cancelled" actionlist, but that may just end up being overly complex, or be turned overly complex by the end user. It's usually better to make sure scenes that may cause issues simply can't be skipped or make necessary checks afterwards to make sure that things that shouldn't be there are really not there (and if not, go ahead and force them to go off at that point). Though it might be interesting, not truly sure it'd be that practical, or how easy or hard it'd be for only an "animation reset" or "default animation in case of cancel" would be to implement.
  • edited April 2017
    alverik i agree with you. it would be overly complex.
    i think the easiest way is the 'run when skipping' checkbox.
    the animation reset actions already exist . they just need to be called when skipped

    we ll see what chris thinks in may :-)
  • Been talking with Chris, you don't have to wait until then, you can achieve the effect by using the ActionList: Check running Action, which lets you determine if the current list is being skipped or not - that way you can have a separate animate Action occur if the actionlist stops running. The trick is covered in the 3D video tutorial.
  • Chris should have holiday.
    AC works well.
    I just had my game tested on mobile devices, it works.
    I almost use every feature except containers and  translations.
    No critical issues.

    for this issue:
    I watched the video and my experience is different 
    (game is in 2d , spriteunitycomplex, and mecanim on objects)

    A ingame UI Button calls AC.KickStarter.actionListManager.EndCutscene ();




    I have a sample that shows the problem:
    image
  • When I skip and the character is talking, the last animate action isn't called and the character keeps looking angry, which wouldn't be the case when not skipping.

    Animate & face direction actions not being called when skipping is a good and important thing. 
    Reason: I don't want race-conditions.
    In my opinion animate actions shouldn't run when skipping because ...
    I have a lot of animate-actions in actionlists which animate characters and objects,
    I just looked in one random scene, it alone has 350 animate actions in it.

    The desired behaviour would be
    I have an actionlist with let's say 10 animate actions.
    Nr. 10 resets the character at the end 
    Skip is called between animate 5 and 6.
    6,7,8,9 are ignored when skipped
    10 has the checkbox "Run when skipped"-checked. and the characters gets reset.
    Result: clean skipping of the acl
  • This way AC-devs have full control and are safe from race-conditions and unity-blow-ups.

    about ActionList: Check running:
    If animate actions would be called when skipping I would have to add this action to every animate action except the last one.
    in my case maybe 2000.

    But it's late maybe I misunderstood.
  • edited April 2017
    I think he means something like this: 

    image

    When you connect a "check" type action you can connect it to itself, depending on whatever condition you deem as "failure", then the action will in effect become a looping action (it will continuously run the check until the returned value is true - or false, depending on what you want.)

    In this case the action will check if the action is being skipped,if it's not it will just check again, if it's true (so the action was skipped), then it will run whatever actions you have selected for such an occasion.

    If this doesn't work right or you just don't want to modify your current actionlists to add the runInParallel action, then you could always run a separate actionlist, after the normal actionlist, just to test if the first actionlist is being skipped/is running. If the first/normal actionlist stops running then you can run your "safety" actions.
  • I think I got it now :-)
    I tried the non-looping version with the extra action list for resetting the state when skipped.
    Looks like it works, I ll keep trying.
    I guess I will have to do this everywhere in the game.

    Thank you Alverik for the detailed explanation.
  • I tested the whole day and I think I found the problem.

    I tested all possibilities on 2 NPCs.

    The method in your image and putting the actionlist in a container actionlist which calls a clean up (reset animations) actionlist after the actual actionlist :0)

    Found the problem:
    Action - Character - Animate (on a NPC with sprite unity complex) won't be called after a skip - tested with both methods

    Action - Object - Animate works in both scenarios.

    I will now inject at least 3 Guinness

  • edited April 2017
    "non-looping version"?? No, no matter what actionlist you do the check in, you have to let it loop, else you are just calling the action once for only an instant, and if at that very moment the actionlist was actually running, then all the safety actions will never run. Anyway, I've never used this action before (set to check self is skipping) so I'm not sure how it behaves. I'll try to do some testing when I have the time this week. But if you use the check outside the actionlist you intend to skip, you ought to not use check self is skipping option (because that'll never be true).
  • I appreciate your effort but you don't need to test this.
    I'm pretty sure this is a bug.
    It's a bit complicated to write so I made screenshots of the 2 possible skip solutions.
    (which both don't work with "character animate (sprite unity complex) actions" but do with "object animate mecanim")
    I have to continue working on the game so I will make skip-reset-actions for the characters with object animate actions. Should be just as good, i hope.
    image
    image
  • additional to the #may-bug
    one #may-question for @chris though

    In the first image I have a "Actionlist - check running" action with the "check self is skipping"
    Won't this actionlist run forever if it is never skipped?
    looks infinite-loopy
  • Alright, good to hear it at least works with object: animate action. 

    About your last question, check with the debugging feature List active actionlists in game window (in the settings manager). That way you can actually see what actionlists are running. But it does sound like it could, but I'm not sure how the action itself works (never read that one before). Though, most probably AC cancels all of the actions and actionlists when playmode ends (since they basically run as a form of coroutines), so a true infinite loop will most probably not occur. But, in the case that the actionlist does continue to run during playtime, which is not great either, guess you could just do another check is running, but this time without the check self is skipping. And if that one is true, then try checking for skipping again, that would work as long as skipping is treated differently from just stopping to run. But, I suggest you just test it and see the active actionlists with the debugging options. Good chance Chris thought about this when he added the check self is skipping option.
  • edited April 2017
    well the actionlist disappears
    but I'm gonna stick with the container solution.

    unfortunately I can't reset the play animation with "object - anmiate" 
    I'll have to wait for the fix for that
  • Alright, I did not understand one of your previous posts correctly before. I though you could only safely reset animations using object:animate, but now I get that you mean you can only reset animations that were started by Object:Animate?... though I must say that doesn't make much sense, seeing how both actions types just control mecanim. I wonder if there's a delay needed (something which I encounter a lot in programming). Maybe adding an engine wait with a small delay? or what happens if after skipping the cutscene you call a regular actionlist changing one of the aforementioned animations?... Oh, but anyway, I know you are busy right now, so you should probably just concentrate on your work for a while.
  • sorry my bad. its a typo. i wanted to say that i cant reset the PLAYER animations with the object animate. so i added normal character animations for that case and just wait for a fix.
  • edited May 2017
    It's a confusing issue, to be sure.  I think we need to separate the issues from the misunderstandings, however.

    The ActionList: Check running Action should not be looped - having it run once is enough.  When an ActionList is skipped, it is re-run from the very start to ensure that the effects of all previously-run Actions are also skipped.  Checks are in place to ensure that e.g. Variable Actions are still run correctly.  Apologies to @Alverik if I gave wrong advice about this.

    Therefore, the ActionList: Check running Action will always be run when skipped, regardless of whether or not you've passed that Action naturally before the skipping feature is triggered.

    The rules for how AC treats a skipping animation Action vary between animation engine and the method within that Action (changing parameter, playing clip by name, etc), but Unity has trouble with being told to set a boolean parameter to True and False in the same frame.

    The way around this is to end your ActionList with an animation Action that resets your animation state manually, by playing the intended animation clip by name, rather than changing parameters.  As @Alverik said, this is technique is covered in the 3D tutorial (specifically, this section).  Your idea to reset the animation with Object: Animate is correct - you just need to change the Method to Play Custom.
  • All my NPCs, Player and objects are mecanim not single clips.
    Everything is controlled by parameters.

    The problem is "Object Animate bool" works 
    and Character Animate on SpriteUnityComplex doesn't.

    I found the code that prevents the animation parameter from being set and commented it out.
    AnimEngine_SpritesUnityComplex.cs, line 283






            public override void ActionCharAnimSkip (ActionCharAnim action)

            {

                //
    if (action.methodMecanim != AnimMethodCharMecanim.ChangeParameterValue)

                //{

                    ActionCharAnimRun (action);

                //}

            }  

    This fixed my problem with
    image

    Maybe the unity people fixed the set bool bug you mentioned? u5.4.5p1
    I just tried it a couple of times with this setup and angry got always set to 0 when skipping
    image
  • Possibly.  I will need to do some testing of my own before I change anything officially.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.