I made a structure containing a few variables on an actor that when hit my character applies damage (an arrow), what I’m trying to do is on event any damage the damaged actor reads that structure to get infos like dmg recieve from every type of damage, dmg applied over time, time of the duration of that damage and etecetera. But I can’t get that structure from damage causer cause that structure is especific of the actor “Arrow”. Theres a way to do that? How? My intention is to make a global dmg apply/recieve system using that structure, and whenever a on any damage event occurs it will get all the info from the damage causer, whatever it is (every dmg cause would have that structure on), process that damage acordingly to the reductions (physical go and get reducted by amor, magical from magic resist and so on).
I apologize for my bad English, which I learned playing video games, I’m grateful for the help.
There are two ways;
1- Damage Causer > Cast To arrowBP and pull the struct from there.
2- Use a Blueprint Interface that contains that struct. That way you can use that interface in any damage causer BP and call it from Damage Causer pin without having to cast to a specific actor.
Understood, thank you for the quick answer. The second way, using a blueprint interface, if there are more than one actor “Arrow” they can have diferent values on the DMD structure?
Other thing, the first way, using cast to arrowBP don’t works for me, cause I want the structure to be used from others causes, ex: a shuriken, a sword, a fireball and etc, all the causes using one structure with different values.
Yes, each actor will have the values you set in the interface call when you apply damage.
Ty so much, tomorrow after work, I’ll try and post the results, ty.
I tried to do so, but I think I’m doing something wrong, I created a OnBeginOverlap event in the ArrowBP, that change de BPInterface value and apply damage to overlapped actor, the overlapped actor (my character) OnAnyDamage get the blueprint interface and print the value, but the value didn’t change and is aways 0, how can I make it work?
My mistake on initial explanation. You need to use the event of the interface in your pawn BP. Also you just need the Input, like so:
Then call and set your struct in your arrow(or whatever is causing the damage) BP. You also need to make a check if the overlapping(here i’m using hit event) actor owns the interface:
Then finally call the event in your character BP:
Thank you for the assistence, do just as you say and everything works flawless, many thanks.
I’ll post my results, if there’s something wrong pls let me know.
The EnemyBP, OnBeginPlay:
1-Set the parameters of the IBP as the variables of the EnemyBP, that way I can change the enemy Dmg easily.
2-Spawn the Arrow Actor with that parameters. (put it in a loop to spawn a new arrow after every 2 seconds, just for tests.
The ArrowBP, Event DmgE: Get the new parameters from the Enemy.
ComponentOverlap: Branchs to verify if the actor overlapped can be damaged, output the DmgE to the overlapped actor, destroy the arrow.
The CharacterBP, Event DmgE: Recieve the dmg reducting it by it’s reductors and removing the HP.
The editable variables at the EnemyBP, that I can change to modify enemy dmg. Pretend to create a Commom EnemyBP and Childs that represent each one of the game enemies.