x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

On AnyDamage get a variable or structure from Damage Causer.

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).

alt text

alt text

I apologize for my bad English, which I learned playing video games, I'm grateful for the help.

Product Version: UE 4.21
Tags:
more ▼

asked Jan 22 '19 at 11:50 PM in Blueprint Scripting

avatar image

k23jm
8 1 4

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Jan 22 '19 at 11:57 PM

avatar image

Jacky
16.6k 671 163 673

avatar image k23jm Jan 23 '19 at 12:25 AM

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?

avatar image Jacky Jan 23 '19 at 12:46 AM

Yes, each actor will have the values you set in the interface call when you apply damage.

avatar image k23jm Jan 23 '19 at 01:05 AM

Ty so much, tomorrow after work, I'll try and post the results, ty.

avatar image k23jm Jan 23 '19 at 10:08 PM

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?

alt text

alt text

avatar image Jacky Jan 23 '19 at 10:44 PM

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:

alt text

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:

alt text

Then finally call the event in your character BP:

alt text

int-3.jpg (13.6 kB)
int-1.jpg (67.2 kB)
int-2.jpg (28.7 kB)
avatar image k23jm Jan 23 '19 at 11:32 PM

Thank you for the assistence, do just as you say and everything works flawless, many thanks. :D

avatar image k23jm Jan 24 '19 at 12:14 AM

I'll post my results, if there's something wrong pls let me know.

alt text

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.

alt text

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.

alt text

The CharacterBP, Event DmgE: Recieve the dmg reducting it by it's reductors and removing the HP.

alt text

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.

avatar image k23jm Jan 23 '19 at 12:30 AM

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.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question