Hi guys,
I’m currently rewriting my projects logic to use GAS, and now I’ve a small question about passing custom Information to an ability.
I’ve read the wiki and searched the ARPG example source code but cannot find the correct place to pass a custom UObject (or struct)…
Some Abilities fire projectiles from multiple Sockets from multiple UStaticMeshComponents of a pawn at once.
Therefore I need to pass a list (an UObject or preferably an UStruct if possible) containing the UStaticMeshComponent pointers plus their socket names.
This info does not change after it’s set, so just pass that info once at granting/creation time and set the corresponding variables inside the gameplay ability.
Because those variables of the ability need to be set dynamically the ability’s instantiation policy is set to instance per actor. (If I understood it right, that must be done for my purpose)
And I don’t think passing a custom UObject as “SourceObject” in “GrantAbility” is the correct place. - Or is it?
I’d appreciate it if you can point me in the right direction.
This is how I would do what I interpreted you wanted to do. I would create a blueprint interface named BPI_ProjectileLauncher with the function called GetProjectileStartStaticMeshCompoents which has an output of an array of StaticMeshComponentReferences.
In the gameplay ability blueprint, I would commit ability and if it is committed then wait for a gameplay event which has the payload gameplayeventdata struck containing the instigator and target. (If you want the owning actor of the ability and don’t want to wait for an event, you can call the function Get Owning Actor from Actor Info in the gameplay ability blueprint where Target is default to self)
I would then check if the instigator implements the BPI_ProjectileLauncher interface and then get the projectile start static meshes to get all socket names.