There's something wrong with my BP code can someone assist me?

Hello everyone. I’m fairly new to Unreal Engine and I was inspired by Gow Ragnarok , Atreus lightning bow attack so I decided to work on a chainlink projectile but what happens, is that my projectile bounces between two or more enemies while spawning in front of the enemy inside of in the direction of the other enemy and sometimes the loop never ends. I’ve been working and thinking bout the solution for 2 days now, but all my efforts were futile as I still have the the problem, so can someone kindly help me in this matter? Any assitance would be greatly appreciated as I would like to learn where I’m going wrong.

Here’s the Bp that I came up with-> My ChainLink BP....Please help. posted by anonymous | blueprintUE | PasteBin For Unreal Engine

Hello!

That’s a lot of code, however, I’m not sure you’ve looked into RICOCHET. According to the video, there’s a component for it. It couullddd remove a lot of unnecessary math.

1 Like

HI!

Thank You for responding to my problem but that’s not quite the answer I’m looking for as the projectile can find the nearest enemy to attack but it doesn’t spawn with the right rotation to face the other targets. I’ll try to simplify my code a bit but that was just what I got to work for me at the moment.

1 Like

Okay, I adjusted the code a little bit as the damage wasn’t apply to the enemies with the apply damage node so I switched the apply damage node to an apply point damage node which not causes the enemies to take damage. My previous problem still exist but now it be as too frequest as there is a chance of the projectile spawning through the status component that I created as well as a chance of the enemy getting shocked upon damage. My original concerns still remain the same as I would love to solve the loop issue that I’m currently facing with the enemies, as well as the projectile spawn rotations. With the damage fixed…the status effect is a bit overpowered :sweat_smile: .

Any extra pointers in solving my issue would be greatly appreciated.

Hey @EXORCIST_UwU

here is an example:

UE427_ChainlinkProjectile.zip (1.3 MB)

1 Like

Your Trace Again when you find the player doesn’t make sense to me. You already have all the overlap actors in the array, simply ignore the player (do nothing when you find the player) and let the loop continue.

1 Like

Hello RickdeV,

Thank you for the response.

I gave it a try and issuse still arises but not as frequent any more due to the enemies taking damage. Also due to the almost infinte loop there are a lot of projectiles spawning so there’s some fps lost BUT I can confidently say that it’s a little better than before. Thank you for the response once more.

This is the updated BP → Chain BP Updated. posted by anonymous | blueprintUE | PasteBin For Unreal Engine . I tried to neaten it up, somewhat. I took your advice and the trace wasn’t really doing much so I removed it now the loop just ends if it traces the player within the radius.

Hello L1z4rD89,

That looks almost to exactly what I’m trying to achieve, will check it out.

Thank you for your response.

1 Like

Hopefully you come right with the example, but otherwise you need to start from scratch, I looked through the code and the logic is definitely wrong, and it’s doing things in loops it shouldn’t be doing.
Best to start with a piece of paper and draw your logic out. Dry run it in your mind until you are absolutely sure it’s doing what you think it’s doing, then write the code.

1 Like

Hello L1z4rD89,

Sorry for the late-ish response. I followed the example and I’m happy to say that the continuous spawning isn’t happening anymore BUT sometimes it doesn’t ignore the previously hit enemy, maybe it’s just a node/ miscalculation somewhere but this is the updated code and I tried to merge the two together thank you for the example . It really helped to understand what I was trying to get better, like I didn’t know that there was a set actor location node :sweat_smile:.

Updated code-> Chain BP Updated. posted by anonymous | blueprintUE | PasteBin For Unreal Engine

Hello Rickdev,

sorry for the late-ish response.

Yes, the example helped me get a better gasp of what I was trying to do and I did re-worked the code as well as tried to merge the two together. The problem no longer exist and I’ve mentioned what I’m encountering at the moment in the comment above. The new code is also in the comment and I would appreciate it very much if you can take a brief look of the coding.

It works very similarly to the example but I think made a miscalculation somewhere as the projectile sometimes keep hitting one target when it can’t find any nearby so I’ll keep playing around with it till I get my desired result. I believe the chain count might be the problem but I’m not to sure. I’ll check it later as I’m very exhausted at the moment.

{This issue was fix later by containing the projectile into a separate actor so it can act independantly, before all my code was in one and that was causing the projectile to act goofy in game.}

Thank you all very much for your assistance!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.