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 do I spawn actors at random locations but NOT near player

I would like enemies to spawn at random locations around my map, but from a certain distance from the player so they spawn offscreen.

I tried making a condition where I exclude spawns that would happen within 1000 units to the player, but it doesn't work. The enemies just keep appearing randomly everywhere, even right next to the player.

Hope someone can help, Thanks!

alt text

Product Version: UE 4.12
Tags:
more ▼

asked Sep 05 '16 at 10:13 PM in Blueprint Scripting

avatar image

Andras D Ormos
18 3 6 7

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

2 answers: sort voted first

i'm not sure about what origin does, (the documentation about it is poor) but looks like if you set the player location as origin it will make the "position" be a value relative to the player position. try setting it to 0,0,0 and try again

PS.:1000 units can be a short distance depending on your game

PS.:your loop seems useless, the branch will only be called in the last element of the vector

more ▼

answered Sep 05 '16 at 10:39 PM

avatar image

veccher
1.1k 31 17 66

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

I'm not sure about the origin thing, but yeah the way I was getting the distance between the two locations was horribly wrong.

Here's how I should've done it the first place.

alt text

solvedproblem.png (169.5 kB)
more ▼

answered Sep 06 '16 at 08:02 PM

avatar image

Andras D Ormos
18 3 6 7

(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