Download

Activating gameplay abilities

I’m trying to figure out how to activate a simple test gameplay ability, but it’s giving me warnings when I try from the client. I’ve given the ability system component the abilities it needs, and I activate the ability by calling AbilitySystem->AbilityLocalInputPressed(0); when I want to activate it. The ability executes just fine on the server player, and it executes fine if I set the ability to ServerInitiated mode, but if I set it to LocalPredicted and try to activate it from the client I get this message in the log:
LogAbilitySystem:Warning: Can’t activate LocalOnly or LocalPredicted ability Default__TestAbility_C when not local!
Are there any examples of using the ability system, or does anybody know why this is happening?

I’m going to start with some caveats that the ability system is not ready for general use yet. It is being used internally but is still being actively worked on. Use at your own risk. If you do use it features that you’re depending on may change or disappear without warning. I wouldn’t recommend using this system yet unless you know you need it and have experienced programmers on your team.

That warning means that you have an ability that should be started by your local client but someone else (either the server or another client) is trying to initiate it. Since you said that it works fine when the net execution policy is ServerInitiated you’re probably trying to activate the ability on the server. Check your code that activates the ability and verify that is only being run on the local client and never gets run by the server.

I just checked to make sure it only runs on the client. I saw a lot of older threads saying it wasn’t read for general use, but that it would be stabilizing soon, so I figured it might be by now. Oh well, if that’s the case still then I guess I’ll just roll my own ability system. Do you have any estimate for when it might be ready?

I do not have an estimate for when it will be ready for wide spread use. When we think it’s ready you should see some kind of announcement in the release notes.

It sounds like you haven’t seen the ability activating on the server. Have you tried putting a breakpoint on the line with the warning and investigating why bIsLocal is false?

Yeah. It’s pretty complex to follow, but it seemed like it got called twice and only failed on the second call, which I assumed was triggered through an RPC.

Thanks. I’ll keep an eye out for the announcement in the release notes.