I’m working in C++ first and foremost. I’m trying to set up temporary weakpoints for enemies when an ability is activated.
For my first approach I tried creating sockets on the enemy skeleton but I’m not sure how to detect when a socket is caught in my line trace. I tried using HitResult.BoneName.ToString() but it only returns bone names not socket names. How can I detect socket names?
For my second approach I was thinking of creating weakpoint actors that are spawned and attached to custom sockets when the ability was active. But I also don’t know how to differentiate between types of actors with a line trace.
A solution to either of these would be appreciated.
Actors (or components) attatched to a socket seems reasonable.
The line trace will tell you the hit actor and hit component if you do “break hit result.”
You can then either implement some particular interface on the actor/component, or you can try casting to particular classes. Or you can override “apply damage” for those actors to multiply by some value and forwarding “apply damage” to the parent object.
I see thank you, but do you know what function is used to differentiate the actor type? I.e. They’ll all be AWeakPoint and I’ll likely use an if statement based on that
If you have multiple types of weak point, then there are many ways of doing this:
You could subclass AWeakPoint for each type, and implement the “do the thing” function differently (polymorphism.) This is probably cleanest.
You could add a field in the AWeakPoint blueprint that takes a number, string, or enumeration value of what kind of weak point it is, and test that in the line cast function.