I’m using the Gameplay Ability System in UE4.26. I’m also supporting multiplayer.
A number of actions are very easy to model with Abilities, Effects, and Cues, and I like it so far!
However, one action is giving me trouble at the “conceptual modeling” level: “pick up into inventory”
I have a typical interactable prompt system, where the player is near or points at an interactable thing, which causes a “Press E to Do The Thing” prompt to show up, and when pressing E, the focused Interactable gets the “Do The Thing” event. This works parallel to the GAS – I don’t need GAS to “open door” or whatever, and I don’t need to add a GAS component to every interactable door / button / sign in the world.
Now, inside an inventory item, or collectible item (“harvest herbs” or “chop wood” or “pick up item”) I need to apply an interaction to the player:
- play the pickup animation, which may vary based on the object kind
- play a cue with some object-dependent variation, e g “herbs zoom into backback” in the world
- apply an effect that actually puts the thing in the appropriate inventory
- while doing this, apply an effect that says the player can’t move or do other things
So far, this sounds like a reasonable breakdown.
What I have problems with, is how to use parameterized Abilities, Cues, and Effects. I need to pass in a few parameters from the Interactable, when starting the ability:
- The item kind to add to the inventory in the add-to-inventory effect
- The mesh or sprite to use for the “zoom to backpack” cue
- The particular animation and/or IK location to use for the “pick up” montage
In the best of worlds, there’s a way to bundle this data up in a struct/object that configures the Ability on invocation, and then that Ability can forward those pieces of information to each Effect / Cue. But I can’t find a good way to provide that information to the invocations.
How am I supposed to do this? Ideally, both from C++ and Blueprints, because many simple interactions are better built in blueprints, whereas some more involved interactions would probably work better in C++.