Help with a particular implementation of GAS.

Hey! Thanks anyone who takes the time to answer.

I am really struggling to understand how to properly set up the Gameplay Ability System in my project. It is a MOBA but it needs to be structured more similar to an RTS. (camera in the sky, possible to control multiple units in certain cases)

there is loads of documentation on how to set up and init the ASC on both the player state and on characters themselves, but there is not much on how to handle ownership and avatars in a situation where the player ASC (in this case playerstate), needs to be able to command an ai controlled pawn as its avatar from the sky.

I have tried to have the AI controllers of each unit have thier own asc with thier own abilities but it really struggles to connect to the the player properly and i cant use much of the functionality with Spec handles to populate the ability bar on my players widgets.

now i am attempting to implement the ASC on the playerstate instead and have the unit as the avatar. however i am stuck on how this should be set up. With this structure, where would i init the asc on the server/client? Should I have the units also init on possession with the AI controllers as thier owners and leave it? should I override ownership of the unit to the playerstate so both client and server see the playerstate as the owner and the unit as the client?

A bonus question would be, how would a structure like this handle switching units? if i select a different pawn that i own, how do you typically handle avatar switching and granting/removing abilities between them?

im just mostly confused on the typical structure for ownership when doing a top down controlled setup and would appreciate anyone who knows the basics of GAS letting me know.

Your NPC Pawns should each have their own ASC to handle attacks, damage, buffs, etc. I wouldn’t put the ASC on the Controller. Your pawn’s owning their own ASC/Attributes lets you possess different pawns at will with your PlayerController or let the AIController handle the pawn behavior. The attributes/abilities stick with the pawns.

Your custom PlayerController should have the logic for switching between pawns. You don’t need GAS for this, just create and call a Reliable Server Event to do it.

If you need an ASC player-centric use add another to your PlayerState for handling attributes/abilities not related to the individual ‘avatars’ or NPCs. I would skip this initially, and add it ONLY if your needs aren’t met doing ASCs on the pawns.