{"id":6656,"date":"2021-07-07T21:41:36","date_gmt":"2021-07-07T21:41:36","guid":{"rendered":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/"},"modified":"2021-07-08T15:24:24","modified_gmt":"2021-07-08T15:24:24","slug":"health","status":"publish","type":"docs","link":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/","title":{"rendered":"Health"},"content":{"rendered":"\n<p>This example will show you how to use a Health value to decrement before giving resources to the player.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>fOLIAGE aCTOR sETUP<\/strong><\/h2>\n\n\n\n<p>First open up your BP_FoliageActor blueprint and override the &#8220;<strong>Handle Foliage Damage<\/strong>&#8221; function, this will override the default behavior of the Damage event and lets you add your own custom logic to it.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/1-4.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"659\" height=\"966\" src=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/1-4.jpg\" alt=\"\" class=\"wp-image-6658\" srcset=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/1-4.jpg 659w, https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/1-4-205x300.jpg 205w\" sizes=\"auto, (max-width: 659px) 100vw, 659px\" \/><\/a><\/figure><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Next add a &#8220;<strong>Health<\/strong>&#8221; variable of type <strong>float<\/strong>, set it to a default value of <strong>100<\/strong> and make it <strong>Replicated <\/strong>(if you&#8217;re making a multiplayer game)<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/2-5.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"594\" src=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/2-5-1024x594.jpg\" alt=\"\" class=\"wp-image-6659\" srcset=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/2-5-1024x594.jpg 1024w, https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/2-5-300x174.jpg 300w, https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/2-5-768x445.jpg 768w, https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/2-5.jpg 1381w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Here is the logic that we&#8217;re going to be using in the &#8220;<strong>Handle Foliage Damage<\/strong>&#8221; function that we overrode in the previous step, this will reduce the Health value every time the foliage <strong>takes damage<\/strong> and if the health value reaches <strong>0<\/strong> we will apply damage and give the player their <strong>reward<\/strong>.<\/p>\n\n\n\n<p>The important step here is to reset the Health value to <strong>100 <\/strong>once it&#8217;s been reduced to 0, also don&#8217;t forget to &#8220;<strong>call parent function<\/strong>&#8220;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/3-2.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"264\" src=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/3-2-1024x264.jpg\" alt=\"\" class=\"wp-image-6660\" srcset=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/3-2-1024x264.jpg 1024w, https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/3-2-300x77.jpg 300w, https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/3-2-768x198.jpg 768w, https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/3-2-1536x396.jpg 1536w, https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/3-2-2048x529.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>You can add the &#8220;<strong>Parent:<\/strong>&#8221; function by &#8220;<strong>Right Clicking<\/strong>&#8221; the &#8220;<strong>Handle Foliage Damage<\/strong>&#8221; node and selecting &#8220;<strong>Add call to parent function<\/strong>&#8221; from the menu<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/parent.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"447\" height=\"626\" src=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/parent.png\" alt=\"\" class=\"wp-image-6702\" srcset=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/parent.png 447w, https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/parent-214x300.png 214w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><\/a><\/figure><\/div>\n","protected":false},"featured_media":0,"parent":6653,"menu_order":5,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-6656","docs","type-docs","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Health - eelDev<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Health - eelDev\" \/>\n<meta property=\"og:description\" content=\"This example will show you how to use a Health value to decrement before giving resources to the player. fOLIAGE aCTOR sETUP First open up your BP_FoliageActor blueprint and override the &#8220;Handle Foliage Damage&#8221; function, this will override the default behavior of the Damage event and lets you add your own custom logic to it. ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/\" \/>\n<meta property=\"og:site_name\" content=\"eelDev\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-08T15:24:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/1-4.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/\",\"url\":\"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/\",\"name\":\"Health - eelDev\",\"isPartOf\":{\"@id\":\"https:\/\/eeldev.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/1-4.jpg\",\"datePublished\":\"2021-07-07T21:41:36+00:00\",\"dateModified\":\"2021-07-08T15:24:24+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/#primaryimage\",\"url\":\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/1-4.jpg\",\"contentUrl\":\"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/1-4.jpg\",\"width\":659,\"height\":966},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eeldev.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Foliage Plugin\",\"item\":\"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Bonus Examples\",\"item\":\"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Health\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/eeldev.com\/#website\",\"url\":\"https:\/\/eeldev.com\/\",\"name\":\"eelDev\",\"description\":\"eelDev.com\",\"publisher\":{\"@id\":\"https:\/\/eeldev.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/eeldev.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/eeldev.com\/#organization\",\"name\":\"eelDev\",\"url\":\"https:\/\/eeldev.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eeldev.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/eeldev.com\/wp-content\/uploads\/2022\/12\/logo_new_transparent-4.png\",\"contentUrl\":\"https:\/\/eeldev.com\/wp-content\/uploads\/2022\/12\/logo_new_transparent-4.png\",\"width\":2048,\"height\":682,\"caption\":\"eelDev\"},\"image\":{\"@id\":\"https:\/\/eeldev.com\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Health - eelDev","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/","og_locale":"en_US","og_type":"article","og_title":"Health - eelDev","og_description":"This example will show you how to use a Health value to decrement before giving resources to the player. fOLIAGE aCTOR sETUP First open up your BP_FoliageActor blueprint and override the &#8220;Handle Foliage Damage&#8221; function, this will override the default behavior of the Damage event and lets you add your own custom logic to it. ... Read more","og_url":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/","og_site_name":"eelDev","article_modified_time":"2021-07-08T15:24:24+00:00","og_image":[{"url":"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/1-4.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/","url":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/","name":"Health - eelDev","isPartOf":{"@id":"https:\/\/eeldev.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/#primaryimage"},"image":{"@id":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/#primaryimage"},"thumbnailUrl":"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/1-4.jpg","datePublished":"2021-07-07T21:41:36+00:00","dateModified":"2021-07-08T15:24:24+00:00","breadcrumb":{"@id":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/#primaryimage","url":"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/1-4.jpg","contentUrl":"https:\/\/eeldev.com\/wp-content\/uploads\/2021\/07\/1-4.jpg","width":659,"height":966},{"@type":"BreadcrumbList","@id":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/health\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eeldev.com\/"},{"@type":"ListItem","position":2,"name":"Foliage Plugin","item":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/"},{"@type":"ListItem","position":3,"name":"Bonus Examples","item":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/"},{"@type":"ListItem","position":4,"name":"Health"}]},{"@type":"WebSite","@id":"https:\/\/eeldev.com\/#website","url":"https:\/\/eeldev.com\/","name":"eelDev","description":"eelDev.com","publisher":{"@id":"https:\/\/eeldev.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/eeldev.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/eeldev.com\/#organization","name":"eelDev","url":"https:\/\/eeldev.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eeldev.com\/#\/schema\/logo\/image\/","url":"https:\/\/eeldev.com\/wp-content\/uploads\/2022\/12\/logo_new_transparent-4.png","contentUrl":"https:\/\/eeldev.com\/wp-content\/uploads\/2022\/12\/logo_new_transparent-4.png","width":2048,"height":682,"caption":"eelDev"},"image":{"@id":"https:\/\/eeldev.com\/#\/schema\/logo\/image\/"}}]}},"comment_count":0,"_links":{"self":[{"href":"https:\/\/eeldev.com\/index.php\/wp-json\/wp\/v2\/docs\/6656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eeldev.com\/index.php\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/eeldev.com\/index.php\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/eeldev.com\/index.php\/wp-json\/wp\/v2\/comments?post=6656"}],"version-history":[{"count":6,"href":"https:\/\/eeldev.com\/index.php\/wp-json\/wp\/v2\/docs\/6656\/revisions"}],"predecessor-version":[{"id":6706,"href":"https:\/\/eeldev.com\/index.php\/wp-json\/wp\/v2\/docs\/6656\/revisions\/6706"}],"up":[{"embeddable":true,"href":"https:\/\/eeldev.com\/index.php\/wp-json\/wp\/v2\/docs\/6653"}],"next":[{"title":"Simulating Physics","link":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/simulating-physics\/","href":"https:\/\/eeldev.com\/index.php\/wp-json\/wp\/v2\/docs\/6666"}],"prev":[{"title":"Foliage Actor Overrides","link":"https:\/\/eeldev.com\/index.php\/docs\/foliage-plugin\/bonus-examples\/foliage-actor-overrides\/","href":"https:\/\/eeldev.com\/index.php\/wp-json\/wp\/v2\/docs\/6677"}],"wp:attachment":[{"href":"https:\/\/eeldev.com\/index.php\/wp-json\/wp\/v2\/media?parent=6656"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/eeldev.com\/index.php\/wp-json\/wp\/v2\/doc_tag?post=6656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}