I’ve been racking my brains trying to get this to work with no joy so far. This is all being done in BluePrint and starting off with the First Person starter.
I have BP actor that simply moves down with a timeline - there are/will be many of them around the level, I want to fire at each actor and they will move on their individual timelines but I’m having trouble with the communication between MyCharacter and the actor’s BPs.
First I thought creating a DamageType would do the job but to ‘Apply Damage’ I found that you are required to specify which actor in the level you want to damage - which I found strange, why can’t I just set that to damage anything and call a ‘Taken Damage From This Damage Type’ on the other side?
Then I gave up on DamageTypes and thought I’d just do a straight forward Line Trace and maybe call a custom function to find if I hit a certain type of Actor/BP then fire an event within that actor. But I can’t find out how to do this either. The tracing part all works fine (debug shows correctly and all), it’s the calling the BP Actor to do things on the other side I’m having issues with.
I have tried playing around with the BP Interface already setup in the First Person starter but not sure how that can be used to my advantage as I am unable to create an event for the Interface in my Actor’s BP.
I’m kind of stuck tbh and could do with some help on how either of these can be achieved.
I roughed this out for you. Its very basic and i’m not a hundred percent on the vector math, in theory based on the damage type it should either move 300 units in the forward vector of our actor or -300 units. This movement would be more of a teleport, you’d probably want to apply an impulse or force rather than set the location. This rough BP assumes you only have two types of damage if you have more than two types you would have to branch further from false. This also is only assessing the type and moving the actor, you would have to have something else for calculating the damage and anything else you want to do. You should do this in the actors not the projectiles, those should just be basic and only care about themselves (unless you want them to care about other things). Let me know if you have any questions.
Hey Thanks for the reply Ryan.
I see there that the DTypeVariable is a blue variable - so an actor? though I’m not sure how I apply my damage types to this (They are not in the drop down list of DTypeVariable) How would I convert my Damage Types (purple) to and Actor (blue) in BP?
It is a damage type variable, you can have different versions of variables like objects, classes and struct. If you hover over the pin it the first thing should say what kind it is then the type. You can’t reference blueprints in others right now so you can make a damage type BP, then in this BP make that variable and in the defaults set it to you blueprint one you make as a work around.
Curious as to what you are trying to do. Are you trying to make it so your BP Actors are only affected by damage from your character? Trying to make damaging one affect the others? You can get what hit the actor and check from there. BP Interfaces are basically just function templates, the functions get defined in the BP they are called and called in all BP they are in when one is called. There is a way to make it so the defined function is only called in the one BP. As an example say you have a body and core changes color based on damage, the limbs would call the function saying they were hit, calling the one in the core to modify the color, but if the core is hit it doesn’t need to let the limbs know (in this example) so you would use this alternate call to the function.
My BP Actors need to be damaged by the character and there needs to be 2 fire types, 1 will move the BP actor in one direction and the second fire type will move the BP actor in the opposite direction. It’s as simple as that really. whether this can be done with a trace or damagetype - it doesn’t really matter.
I’m either looking at this too hard and not seeing how it can be done or I’m just being stupid haha.
I forgot to mention that there will also be other - different BP actors that will also be affected by the same fire types so I need to take those into account too.