{"id":234,"date":"2024-06-24T21:19:20","date_gmt":"2024-06-24T21:19:20","guid":{"rendered":"https:\/\/www.thegames.dev\/?p=234"},"modified":"2024-06-24T22:59:55","modified_gmt":"2024-06-24T22:59:55","slug":"gameplay-cues-without-using-a-gcn-gcna","status":"publish","type":"post","link":"https:\/\/www.thegames.dev\/?p=234","title":{"rendered":"Gameplay Cues without using a GCN\/GCNA"},"content":{"rendered":"\n<p>You can use GameplayCues directly on an actor without needing to create a GameplayCue notify blueprint or a GameplayCue Actor blueprint.<br>This can be really powerful, allow you to manage specific cues either natively or directly in the actor\/object&#8217;s blueprint.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\">Getting Started:<\/h2>\n\n\n\n<p>To get started, your actor or object receiving the cue MUST implement the following interface:<br><strong>IGameplayCueInterface<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: Relevant Code:; notranslate\" title=\"Relevant Code:\">\nclass KAOSGAMECORE_API AKaosMoverPawn : public AKaosPawn, public IGameplayCueInterface\n<\/pre><\/div>\n\n\n<p>This interface has the following functions you can override:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>virtual void HandleGameplayCue(UObject* Self, FGameplayTag GameplayCueTag, EGameplayCueEvent::Type EventType, const FGameplayCueParameters&amp; Parameters);<\/li>\n\n\n\n<li>virtual void HandleGameplayCues(UObject* Self, const FGameplayTagContainer&amp; GameplayCueTags, EGameplayCueEvent::Type EventType, const FGameplayCueParameters&amp; Parameters);<\/li>\n\n\n\n<li>virtual bool ShouldAcceptGameplayCue(UObject* Self, FGameplayTag GameplayCueTag, EGameplayCueEvent::Type EventType, const FGameplayCueParameters&amp; Parameters);<\/li>\n\n\n\n<li>virtual void GameplayCueDefaultHandler(EGameplayCueEvent::Type EventType, const FGameplayCueParameters&amp; Parameters);<\/li>\n<\/ul>\n\n\n\n<p>These functions will be called on the interface (and thus the actor\/object implementing it) so it can handle the cue (if it wants to).<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\">ShouldAcceptGameplayCue<\/h2>\n\n\n\n<p>This can be used to determine if the actor\/object should accept the cue or not. Reasons for not excepting a cue could be its a GameplayCue.Damage cue and the actor is dead, and you wish not to do anything.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\">HandleGameplayCue \/ HandleGameplayCues<\/h2>\n\n\n\n<p>These two functions will be called so you can handle a cue generically for the actor\/object. You may wish to do forwarding logic here, maybe you activate a cue GameplayCue.Weapon.Activation and wish to forward it to the weapon the player is holding, so the weapon can handle the cue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\">GameplayCueDefaultHandler<\/h2>\n\n\n\n<p>This will get called if nothing actually handles the cue. This will also be called if the cue was handled in HandleGameplayCue(s). This is called if no Blueprint Node or UFUNCTION was found to accept the cue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">Defining a Native Cue Handler.<\/h2>\n\n\n\n<p>To define a native cue handler is very simple. The important thing is, the function must be marked UFUNCTION. Example here:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: Relevant Code:; notranslate\" title=\"Relevant Code:\">\n\t\/\/Cue called when the pawn takes damage\n\tUFUNCTION()\n\tvoid GameplayCue_Damage(EGameplayCueEvent::Type EventType, FGameplayCueParameters Parameters);\n\nvoid AAresPawn::GameplayCue_Damage(EGameplayCueEvent::Type EventType, FGameplayCueParameters Parameters)\n{\n\/\/Cue logic here.\n}\n<\/pre><\/div>\n\n\n<p>This function will match GameplayCue.Damage and all children, like GameplayCue.Damage.Elemental.Fire. You can get the original cue in Parameter.OriginalGameplayCue. Useful for doing different FX based on different damage type, etc.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">Defining a Blueprint Cue Handler<\/h2>\n\n\n\n<p>You can make a blueprint cue handler, just by making an event in your blueprint graph, and putting the name as the cue you want to match, example here:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">Forwarding Cues<\/h2>\n\n\n\n<p>I mentioned earlier you can forward cues, to do this, Epic has provided a function to forward to cues to another actor\/object.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: Relevant Code:; notranslate\" title=\"Relevant Code:\">\nUAbilitySystemBlueprintLibrary::ForwardGameplayCueToTarget();\n<\/pre><\/div>\n\n\n<p>An example usage is like this:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: Relevant Code:; notranslate\" title=\"Relevant Code:\">\nvoid AAresGameplayActor::GameplayCue_Damage(EGameplayCueEvent::Type EventType, FGameplayCueParameters Parameters)\n{\n\tif (HealthComponent)\n\t{\n\t\tUAbilitySystemBlueprintLibrary::ForwardGameplayCueToTarget(HealthComponent, EventType, Parameters);\n\t}\n\n\tif (GetWorld()-&gt;GetNetMode() != NM_DedicatedServer &amp;&amp; !IsRunningDedicatedServer())\n\t{\n\t\tCreateHealthBar();\n\t}\n}\n<\/pre><\/div>\n\n\n<p>This about wraps up this very short post. If you want more info or more help, check the contact me page. Can always find me on the Unreal Source Discord Server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can use GameplayCues directly on an actor without needing to create a GameplayCue notify blueprint or a GameplayCue Actor blueprint.This can be really powerful, allow you to manage specific cues either natively or directly in the actor\/object&#8217;s blueprint. Getting Started: To get started, your actor or object receiving the cue MUST implement the following <a href=\"https:\/\/www.thegames.dev\/?p=234\" class=\"more-link\">&#8230;<span class=\"screen-reader-text\">  Gameplay Cues without using a GCN\/GCNA<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-234","post","type-post","status-publish","format-standard","hentry","category-gameplay-ability-system"],"rise-blocks_total_comments":0,"rise-blocks_categories":[{"term_id":4,"name":"Gameplay Ability System","slug":"gameplay-ability-system","term_group":0,"term_taxonomy_id":4,"taxonomy":"category","description":"Unreal Engine's Gameplay Ability System (GAS)","parent":2,"count":16,"filter":"raw","cat_ID":4,"category_count":16,"category_description":"Unreal Engine's Gameplay Ability System (GAS)","cat_name":"Gameplay Ability System","category_nicename":"gameplay-ability-system","category_parent":2}],"rise-blocks_excerpt":"You can use GameplayCues directly on an actor without needing to create a GameplayCue notify blueprint or a GameplayCue Actor blueprint.This can be really powerful, allow you to manage specific cues either natively or directly in the actor\/object&#8217;s blueprint. Getting Started: To get started, your actor or object receiving the cue MUST implement the following interface:IGameplayCueInterface This interface has the..","_links":{"self":[{"href":"https:\/\/www.thegames.dev\/index.php?rest_route=\/wp\/v2\/posts\/234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thegames.dev\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thegames.dev\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thegames.dev\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thegames.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=234"}],"version-history":[{"count":4,"href":"https:\/\/www.thegames.dev\/index.php?rest_route=\/wp\/v2\/posts\/234\/revisions"}],"predecessor-version":[{"id":240,"href":"https:\/\/www.thegames.dev\/index.php?rest_route=\/wp\/v2\/posts\/234\/revisions\/240"}],"wp:attachment":[{"href":"https:\/\/www.thegames.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thegames.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thegames.dev\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}