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"

Issue with respawning player

Hi so I recently put in a re-spawn/checkpoint system and its breaking something in my blueprint. So I have an event tick ruining in a different script that checks the distance to the player alt text
But whenever I destroy the player and then re-spawn him I get these errors alt text

It is not game breaking but it does annoy me, does anyone have an idea of how i could fix this issue?

Product Version: UE 4.12
checkdis.png (78.5 kB)
error.png (72.8 kB)
more ▼

asked Dec 12 '16 at 11:10 PM in Blueprint Scripting

avatar image

131 26 25 35

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

1 answer: sort voted first

Yes this happens because when you destroy the player character the Get Player Character node will return a null object (since the player doesn't exists at that moment) and thus the erros.

What you can do to solve this is to add a check to see if the player exists before trying to read its distance property. You do that with an Is Valid macro node you pass the return pin from the Get Player Character node to the Is Valid node and then you just continue with your stuff in the Is Valid execution line.

Note that this check can be added inside your Check Dist to Player function but you would need to handle the case where the playing doesn't exist by returning something like -1 (Since there aren't negative distances). Or you could do the check before calling your function, if the object is valid, call your function if it isn't then don't call it.

more ▼

answered Dec 12 '16 at 11:32 PM

avatar image

717 18 6 26

(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