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"

How to get a shield that negates damage?

alt textHello, i am trying to create a shield that you get from crossing a box (blueprint from static mesh actor) that is attatched to my controlled ball, to either negate incoming damage once, or return equal health upon taking damage, then to be toggled off until crossing another boost-box

However i cant seem to reference the shield BP antwhere else than in my level blueprint, where i cant put the rest of my pickups that damage the player, if that makes any sense?

If i try getting actors/components from class, it needs an "object" to target, and i dont know what it wants from me :/

Regards

  • Niku

Product Version: UE 4.21
Tags:
problem3.jpg (437.4 kB)
more ▼

asked Feb 03 '19 at 10:05 PM in Blueprint Scripting

avatar image

Niku-zan
7 1 1 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

its alot like your other question, you have your shield actor and you just need a littlbe bit of script in it which runs when the player overlaps it. in this case we can just set a variable in the player (HasShield) to true. then in the player you can have the script needed to enact the changes to damage.

alt text

return equal health upon taking damage,

alt text

negate incoming damage once

alt text

the other option would be to create a actor which gets attached to the player either as a child component or as its own actor to intercept the damage but thats a bit more complex.

capture.png (130.9 kB)
capture1.png (98.1 kB)
capture2.png (52.7 kB)
more ▼

answered Feb 03 '19 at 10:23 PM

avatar image

ThompsonN13
10.1k 33 10 23

avatar image Niku-zan Feb 03 '19 at 10:35 PM

Hmm, it's strange, a lot of my nodes have different inputs and outputs from yours, might have to do with me not using a character at all in this project?

This is the response im getting from trying to set it up :o

alt text

problem4.jpg (211.8 kB)
avatar image ThompsonN13 Feb 03 '19 at 10:43 PM

you added the HasShield variable in the shield actor and not in the ball bp thats why they look different. so just change the location of the variable to be located in the ballBP. guess it wasnt the clearest the way its written.

im not even sure how you managed to get the variable in your ball without a reference.

avatar image Niku-zan Feb 03 '19 at 11:08 PM

Aha, that fixed the connections, but unfortunately it just spawned the shield on the ground, disconnected from my ball, and no damage was prevented :(

avatar image ThompsonN13 Feb 04 '19 at 01:11 AM

you never mentioned anything about spawning so i didnt do anything with that in the example. as for not preventing damage that all depends on how you have damage implemented. for my example i went with the approach of all damage to the player being routed through the event any damage. if you have other actors that are modifying the health variable of the player directly then it wont work. also setting the health of the player from an outside source is not the best way to handle things. for damage systems i personally think its a good idea to use the inbuilt system whenever possible. the inbuilt system uses the apply damage nodes and the event damage nodes which makes things convienent since you wont have to cast or deal with particular classes. also many classes have built in damage options you can make use of.

avatar image Niku-zan Feb 04 '19 at 01:14 AM

The fault is all mine (probably :P) Im still just a few months into unreal, so its hard to explain properties and desired effects properly still.

Im sure it's not the best system i've set up, but its a schoolproject to learn mostely so i still have a ways to go!

avatar image Niku-zan Feb 03 '19 at 11:47 PM

I did manage to make it work in the end, a lot of messy connections, but i guess it works for now :D

Thanks for the contribution, much apreach!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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