Ability Does Not Stop after calling stopabilty function

Emmanuel

New member
I am trying to create a climb ladder ability, I have done everything including setting object ID in collider. Adding animations to base layer and scripting the upward moment of player when ability animation plays. However, when I try to use ontriggerexit override to end the ability. For some reason. The abilityindex at the animator remains the number I set it and does not exit the animator state. It gets stuck in the idle in that state. .Even after calling stopability. I have been on this for hours. I followed the create ability tutorial and did everything. It just doesnt get set back to deafult on exit. Even though the function is being called when I debug text there.
 
I would start by placing a breakpoint within UltimateCharacterLocomotion.TryStopAbility and see why the ability isn't being stopped. If you can tell me what line it returns early on I can then explain what is happening.
 
I dont understand what you mean, I thought breakpoints are suppose to be areas in code where you can pause code flow when code gets there. what line in the UltimateCharacterLocomotion.TryStopAbility should I put a breakpoint? Can you explain what exactly I should do?

Also, I know from my previous breakpoints though that the entire method UltimateCharacterLocomotion.TryStopAbility runs to the end and returns true. and it also runs this function ability.StopAbility(force, true); at line 1418 which seems to run the same code again. So, I am a bit confused
 
Does the ability stop if you look at it within the inspector? It sounded like you placed a breakpoint within the correct location - if TryStopAbility gets to the end and returns true then the ability did stop. The next frame the animator will update and it'll reset the ability index to either the next active ability or 0 if no abilities are active.
 
This is the problem, for some reason. The ability index stays the same. I used 101 for the ability index for this and you can see it remians the same
 

Attachments

  • 1.PNG
    1.PNG
    48.6 KB · Views: 20
  • 2.PNG
    2.PNG
    35.5 KB · Views: 19
  • 3.PNG
    3.PNG
    30 KB · Views: 17
Does AnimatorMonitor.SetAbilityIndexParameter get called? This should get called from UltimateCharacterLocomotion.UpdateAbilityAnimatorParameters.
 
Yes, It gets called and my ability immediately gets called again. I have been able to get it to stop. If i make the starttype to be manual and called the start ability function from ontrigger enter. But this is not a good solution since the abilty does not start the first time i enter the collider. on the second time. Also, the video I saw online says the start type should be automatic. Because walking in to the collider when it is manual does not start the ability. I need to manually call it in ontriggerenter. Is there any suggestion for fixing this problem now that I know the source?
 
You can manually start the ability with UltimateCharacterLocomotion.TryStartAbility. This sounds like it will be a better option for you to precisely control when the ability should start.
 
Calling that on trigger enter does not work the first time. Only the second time. Which makes it slow. Also, can yo suggest a good way to make the player move in a vertical direction. For the ladder. Because with what I do now. It breaks the jump and tall ability
 
When you call TryStartAbility the ability will start unless it is lower priority than an active ability or CanStartAbility returns false. I would set a breakpoint within that method and see why the ability isn't starting.

A good example of changing virtual direction is within the Hang ability from the Agility Pack. If you don't have the Agility Pack you should start by disabling the gravity and then changing the position.
 
I am not happy with the support so far and the reply to my comments so far. I dont see a reason why there is no documentation on code for customization. I would think it is because you intend to sell extra packs. Everything you have suggested has not been of help. I have had to discover the issues myself. Even with the fact that I really want to do things as fast as I can. I see no reason why the bug that doesnt end the ability is not something that was previously known. Can start ability does not start ontriggerenter. It only starts the second time even if it is the highest activity. I have been on this for days.

Also, I find your reply on agility pack really sad, when you know there is no way to change position once the gravity is disabled. You could have as well pointed me in the direction of code used in moving the character in the vertical direction instead of me digging into the code and trying to find it. It is also sad that there is no documentation as people would be able to create abilities for others to use. But I assume ofcourse, you want people to purchase ability packs.

I am sad about this and I still have not gotten an answer to my questions so I ask again:

1. How do I fix starting the ability when it wont start automatically on trigger enter.
2. What function do you already have for making a vertical movement up that would not break the fall and jump animation.

Thanks
 
I dont see a reason why there is no documentation on code for customization.
This page gives a complete example of a new ability:


There are also about 25 abilities included which you can look at the source for. I made sure to comment each method really well so you can dive deep into how it works.

when you know there is no way to change position once the gravity is disabled
This relates to your second question, but you can change the position by modifying the UpdatePosition ability:

Code:
        public override void UpdatePosition()
        {
                var motorThrottle= Vector3.up * Time.fixedDeltaTime;
                m_CharacterLocomotion.MotorThrottle = motorThrottle;
        }

You'll want to have gravity disabled to prevent the character from falling back to the floor.

The Agility Pack is a great example of a more integrate set of abilities so that's why I recommended it. You should be able to create a climbing animation without it though, and on discord I have seen somebody post a gif of a free climbing ability that they created.

For your first question, it sounds like your ability is being blocked by something else so that's why I recommended stepping through the debugger. The code comments should make it easy to follow but if there is something that is unclear let me know and I can tell you the logic behind it. The crawl ability from the docs/video also starts within a trigger so if you use that as a base you should then be able to get your own ability working.
 
Top