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"

Player projectile damage

Hi, So i am currently trying to create a blueprint set which will damage the target player. So i currently have a multiplayer system setup and i am trying to create a system so that when one player damages another player it will remove the health of the target player. However currently when the projectile hits the target player it will register that the projectile has hit but i cannot work out how to remove damage from the target player rather from the projectile spawner and i'm curious to know where i'm going wrong.

alt text

Thanks, Josh

Product Version: UE 4.18
Tags:
capture.png (267.1 kB)
more ▼

asked Jun 15 '18 at 10:41 PM in Blueprint Scripting

avatar image

_Apex
1 1 3

avatar image ThompsonN13 Jun 15 '18 at 11:05 PM

ok so your issue is that the projectile is removing health from the character that shot it and not from the enemy yes? is the enemy of the thirdpersoncharacter class?

im guessing that your player is the first person character and when the projectile is spawned it is overlapping with the player and is therefore removing health from them. to solve this i would either use a hit event, use a arming delay, or create a variable on spawn thats value is the character that spawned it then have a bool to make sure the other actor is not the one that spawned it. doing something like that should take care of the projectile hurting the player that spawned it.

now for applying damage to the other character why are you not using the apply damage and event any damage nodes? its a much simpler system and its a better practice to apply incoming damage in one place. so you would just need on the projectile the apply damage node, then on the character you would have the event and damage and the script that decrements the health.

some of this issue could also be in replication, multiplayer isnt really my thing so i cant tell you for sure but the steps ive outlined should be of help regardless.

avatar image _Apex Jun 15 '18 at 11:22 PM

Honestly i am learning many things still but i will experiment with what u have told me. Thank you for the support. Im curious to know whether its possible to make it so that all variables within a blueprint and unique to each instance of the blueprint which is created within the game. EG gernteting the ThirdPersonChracter multiple times however for each instance of it the variables are unique to its own. and if so how may i go about then targeting the unique blueprint and its variables.

avatar image ThompsonN13 Jun 15 '18 at 11:41 PM

all variables are unique to their instance so you could spawn in two characters of the same class (ThirdPersonChracter) and they would have their own health values for instance. you could decrement the health of one and it would not affect the other. to do this you will need to get a reference to the specific instance that you want to be targeting the changes to. how to get the reference depends on the situation as there are many methods such as using public variables, getting overlapping actors, and traces.

on a side note can you explain things a bit more or check what your writing, its a bit hard to understand. "EG gernteting" for instance, i have no idea what that is meant to say,

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

0 answers: sort voted first
Be the first one to answer this question
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