Download

Best way to make sword do damage?

I added the Paragon characters to my project, and since the weapons isn’t their own separate mesh, I put a collision box around the sword and attached it to the sword tip. How can I make the sword destroy actors when I swing the weapon? currently it just destroys the whole characters on overlap.

I assume you mean that the weapon destroys the enemy if the sword simply comes into contact with them not during a swing?

If that’s the case then these tutorials should help [Links: Tutorial #1, Tutorial #2], moreso the second one since that one deals with how to place limits on when an attack can do damage to a target.

If I may also hijack this thread for my own selfish agenda since I have an interest in finding the optimal way of doing damage to an enemy & the name of this topic is “best way to make sword do damage”, I figure that this topic is probably the best place for me to ask my own questions regarding damage blueprint optimization.

So right now I have a basic setup for dealing damage that can be expanded upon but my concern is that this setup is currently limited exclusively to the blueprint of the cube I’m using a enemy stand-in and not any other potential enemy blueprints.

The reason that this a problem is that since I intend to a have rather large variety of enemies & bosses for the game I’m working on, and that if I have to make a modification to the damage system (and I will since the current sound effect that for hitting enemies is a stand-in and will be replaced later, in addition I also planned on adding a impact special effect later on as well) then I would have to make the same modification to every single individual enemy blueprint, which is not only time consuming but also carries a greater risk of mistakes being made & not noticed until its too late.

So I was wondering if its possible to create some sort of… oh I don’t know since I don’t have a great grasp of all Unreal’s functions & terminology… I guess event/function/doohickey that would contain the blueprint events for dealing damage that could then be called upon in each individual enemy blueprint?

Another issue with the current setup is that it uses the On Component Begin Overlap component for the “enemy”'s collision box. This has been a problem for me because I’ve been also trying to set up a basic system for the player character to take damage which also requires the On Component Begin Overlap (Enemy Collision) component to work and I don’t know how to get both systems to work using the same component as I can’t seem to call up another Overlap component. I also wondered if it would be possible to make a event/function/whatever that would contain the damage to the player functionality like how I would like to implement with attacking the enemy.

I also included the blueprint for my player character’s basic attack, I have no idea if this would help in any way whatsoever but I thought I should include anyway just to be thorough.

Blueprint for my character’s melee attack:

Got it working

I’m probably not the most qualified person to be offering help but if I’m interpreting what your saying correctly then you are directly connecting the On Component Begin Overlap node to the Destroy Actor node. The problem with this is that by default the Destroy Actor node is going to target the subject of the blueprint, in this case your player character, and destroy them. In order for the Destroy Actor node to eliminate targets that are not your player character you have to cast to the desired target’s blueprint from the On Component Begin Overlap & set the enemy’s blueprint as the target for the Destroy Node.

As an example, here’s the jump collision I have set up for my player character. The purpose of the jump collision is to allow my character to take out enemies by jumping on them a la Super Mario, which was accomplished by attaching a collision box beneath my character’s capsule component & using the following node setup:

You should be able to use this as a visual guide on how to enable proper collision with the enemy, just ignore the Launch Character & maybe the Spawn Sound nodes otherwise your character is going to bounce up in the air after damaging the enemy.

Did you check out the links I provided above? I highly recommend them as they’re what I used to get this setup working properly, although I probably should have included this one as well Link], as it is a follow-up to the other two tutorials that delves into dealing damage to a enemy target, although you might want to follow this one first Link] which covers creating a basic enemy for you to use as target practice.