{"id":497,"date":"2025-05-08T19:58:07","date_gmt":"2025-05-08T18:58:07","guid":{"rendered":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/?p=497"},"modified":"2025-05-08T19:58:07","modified_gmt":"2025-05-08T18:58:07","slug":"bsc3b-week-15-added-weapons-attack-animations-and-damaging-killing-enemies","status":"publish","type":"post","link":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/2025\/05\/08\/bsc3b-week-15-added-weapons-attack-animations-and-damaging-killing-enemies\/","title":{"rendered":"BSc3b Week 15- Added weapons, attack animations and damaging\/killing enemies"},"content":{"rendered":"\n<p>For weapon models I have the sword, bow and arrow models (For if I have time to implement ranged combat for bow and arrow) from: <a href=\"https:\/\/www.fab.com\/listings\/d1364c72-f6dc-473a-a947-cdf3a6bc8d4c\">Low Poly RPG Fantasy Weapons Lite | Fab<\/a><\/p>\n\n\n\n<p>For the attack animations I&#8217;m using the Stable Sword Inward Slash from Mixamo.<\/p>\n\n\n\n<figure class=\"wp-block-image alignwide size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"577\" src=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-49-1024x577.png\" alt=\"\" class=\"wp-image-499\" srcset=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-49-1024x577.png 1024w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-49-300x169.png 300w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-49-768x433.png 768w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-49.png 1309w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This is what the animation montage looks like in engine with it retargeted to the correct model also included in this is a notify called attack which when the animation reaches that point will call an event.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"867\" height=\"178\" src=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-50.png\" alt=\"\" class=\"wp-image-500\" srcset=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-50.png 867w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-50-300x62.png 300w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-50-768x158.png 768w\" sizes=\"auto, (max-width: 867px) 100vw, 867px\" \/><\/figure>\n\n\n\n<p>This is the notify Attack event which just casts to the player character and calls a custom event called Attack. This is in the Quinn animation blueprint.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"340\" height=\"152\" src=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-52.png\" alt=\"\" class=\"wp-image-502\" style=\"width:388px;height:auto\" srcset=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-52.png 340w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-52-300x134.png 300w\" sizes=\"auto, (max-width: 340px) 100vw, 340px\" \/><\/figure>\n\n\n\n<p>This is the Attack node which just calls to an Attacked function in the sword blueprint.<\/p>\n\n\n\n<figure class=\"wp-block-image alignwide size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"970\" height=\"381\" src=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-51.png\" alt=\"\" class=\"wp-image-501\" srcset=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-51.png 970w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-51-300x118.png 300w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-51-768x302.png 768w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/figure>\n\n\n\n<p>This is what handles the attack input which gets the current montage if it&#8217;s equal to the sword swinging animation then it prints out already attacking otherwise it plays the sword swing animation montage.<\/p>\n\n\n\n<figure class=\"wp-block-image alignwide size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"288\" src=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-53-1024x288.png\" alt=\"\" class=\"wp-image-503\" srcset=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-53-1024x288.png 1024w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-53-300x84.png 300w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-53-768x216.png 768w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-53.png 1464w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Finally for the player character this is what attaches the sword actor to the player. This does this at the beginning of play by spawning an actor of the sword blueprint class and spawning it at the socket transform of the hand_rSocket of the player characters mesh. Then attaching the sword to that component socket. Also sets sword ref equal to the sword just spawned.<\/p>\n\n\n\n<figure class=\"wp-block-image alignwide size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"260\" src=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-54-1024x260.png\" alt=\"\" class=\"wp-image-505\" srcset=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-54-1024x260.png 1024w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-54-300x76.png 300w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-54-768x195.png 768w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-54.png 1129w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This is the Attacked function in the Sword which gets all the actors of the enemy class then loops each of them checking if they are overlapping the Blade (capsule collision of the sword) and if it is calling take damage in the enemy.<\/p>\n\n\n\n<figure class=\"wp-block-image alignwide size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"930\" height=\"268\" src=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-55.png\" alt=\"\" class=\"wp-image-506\" srcset=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-55.png 930w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-55-300x86.png 300w, https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/image-55-768x221.png 768w\" sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/figure>\n\n\n\n<p>This is the take damage function of the enemy which minuses 50 from their health then checks if their health is equal to 0 which if it is it destroys the actor otherwise print strings the health.<\/p>\n\n\n\n<figure class=\"wp-block-video alignwide\"><video height=\"720\" style=\"aspect-ratio: 1280 \/ 720;\" width=\"1280\" controls src=\"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2025\/05\/2025-05-08-19-53-08.mp4\"><\/video><\/figure>\n\n\n\n<p>This is what it looks like in game given that the enemy doesn&#8217;t have anything it does when it can&#8217;t see the player easy to hit them before they see you but can easily hit them in both instances. It does have some problems like it could look like it should hit the enemy sometimes but if it&#8217;s not overlapping when the attack notif is reached in the animation montage then it doesn&#8217;t hit them.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For weapon models I have the sword, bow and arrow models (For if I have time to implement ranged combat for bow and arrow) from: Low Poly RPG Fantasy Weapons Lite | Fab For the attack animations I&#8217;m using the Stable Sword Inward Slash from Mixamo. This is what the animation montage looks like in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,3],"tags":[],"class_list":["post-497","post","type-post","status-publish","format-standard","hentry","category-bsc3b","category-devlog"],"_links":{"self":[{"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts\/497","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=497"}],"version-history":[{"count":4,"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts\/497\/revisions"}],"predecessor-version":[{"id":511,"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts\/497\/revisions\/511"}],"wp:attachment":[{"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}