Forum rules - please read before posting.

Problems with animation formats in blend tree

2»

Comments

  • edited June 2021

    I unchecked and had no effect, the animation problem continues.

    the only warnings that appear, some are of lost scripts on the door that already came in combat example.

    https://uploaddeimagens.com.br/imagens/wG5apV4

    At the moment of meeting the zombie I noticed that when I press the control button that opens doors, collects items, etc., the player freezes but keeps the ''idle'' movement and the zombie stops any action as if it were in pause, even when the zombie is dead on the ground; There is no error or warning of what could be.

  • I unchecked and had no effect, the animation problem continues.

    Use a Debug statement to confirm that the trigger is being invoked on the correct animator. Underneath:

    player.GetAnimator ().SetTrigger ("TakeDamage");
    

    Insert:

    Debug.Log ("'TakeDamage' trigger sent to " + player, player);
    

    Check the Console for this message at the time it should play. Assuming it shows, click on it - it should point to the Player in the scene. Is this the case, and does your Player only have one Animator component? If not, you may need to have your script specify which Animator to affect.

    when I press the control button that opens doors, collects items, etc., the player freezes but keeps the ''idle'' movement and the zombie stops any action as if it were in pause, even when the zombie is dead on the ground;

    The example makes use of a "PauseEnemies" Global boolean variable to freeze enemies whenever the Player is in a cutscene, or the Inventory / Interaction menus are on. This behaviour can be configured in the example's CustomInteraction script. Specifically, the end of the Update function is where the PauseEnemies variable value is set.

  • I did and it didn't work

    No warning or error appears when the zombie bites.

    https://uploaddeimagens.com.br/imagens/LNdPdfk

    In the animator I just changed the controller name ''girl'' to '' controlPolice'' and I changed the animations.

  • My apologies - there was a typo in the CombatCharacter script.

    Open this script and find the TakeDamage function. Around line 51, replace:

    else if (damage < 0)
    

    with:

    else if (damage > 0)
    
  • That's right, it worked until the scream of the player appears, thank you very much. Is there anything to add so that the player in the attack doesn't obey the control until the bite's animations are over?

  • You can reduce the player's movement speed with:

    player.walkSpeedScale = 0f;
    player.runSpeedScale = 0f;
    

    A coroutine that does so, waits a second, and reverts it to normal:

    private System.Collections.IEnumerator DisableMovement ()
    {
        player.walkSpeedScale = 0f;
        player.runSpeedScale = 0f;
        yield return new WaitForSeconds (1f);
        player.walkSpeedScale = originalWalkSpeed;
        player.runSpeedScale = originalRunSpeed;
    }
    

    If you paste that into the script, the following can then be used in the OnTakeDamage function to disable movement and firing for 1 second:

    SetAttackDelay (1f);
    StartCoroutine (DisableMovement ());
    
  • edited June 2021

    private System.Collections.IEnumerator DisableMovement ()
    {
    player.walkSpeedScale = 0f;
    player.runSpeedScale = 0f;
    yield return new WaitForSeconds (1f);
    player.walkSpeedScale = originalWalkSpeed;
    player.runSpeedScale = originalRunSpeed;
    }

    do I put in the player combat script?

  • edited June 2021

    Yes. Alternatively, I have updated the template package with this change.

  • it worked, but if I press the right or left stick the character rotates.

  • edited June 2021

    Try this replacement instead:

    player.walkSpeedScale = 0f;
    player.runSpeedScale = 0f;
    player.turnSpeed = 0f;
    yield return new WaitForSeconds (1f);
    player.walkSpeedScale = originalWalkSpeed;
    player.runSpeedScale = originalRunSpeed;
    player.turnSpeed = originalTurnSpeed;
    
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.