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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to influence actor spawning from a different level, in-game?,How do I influence one level from another level, in-game?

Hi, I'm new to UE4 and scripting of any kind. I've searched through the documentation for UE4 for three days, but I don't think I know the proper terminology in order to ask the right question. Please have patience as I try to describe my problem.

I'm working on my second learning experience in UE4 (the first was a basic sidescroller) and have been trying to create blueprints that would mimic the gameplay of the old Pokemon games.

I have been able to create a blueprint actor that, when overlapped with by the player, has a 15% chance of sending the player to a separate level (like walking in the grass). I used a random float and a branch to do this and it works just fine.

Once in the "encounter level" I want an actor to spawn according to odds that I decide (for example, every time you enter the encounter level there is a 40% of spawning ActorA and a 60% of spawning ActorB). I would then want the actor to be destroyed (after a brief delay) and the player sent back to the starting level, ready to continue the adventure. I'm not yet trying to build the system for a battle.

My issue was that when the player would be sent to the encounter level more than once in a session of play, the same random float would be used which would, in turn, spawn the same actor every time. I've spent three days trying to set my blueprints up properly, with no success.

I'm sure that my blueprints and methods are barbaric, so any instruction/advice (especially with pictures) is greatly appreciated. Below are some screenshots of where I'm currently at with my plight. Thanks!!!

alt textalt text

Product Version: UE 4.21
screenshot-1.png (1.9 MB)
screenshot-2.png (942.8 kB)
more ▼

asked Jan 07 '19 at 08:55 PM in Blueprint Scripting

avatar image

3 1 1

avatar image crazyhooligan77 Jan 07 '19 at 10:08 PM

Hello, are you trying to: a)stop the player from entering the encounter level multiple times through the same patch of grass in one game. b)allow the player to enter the encounter level through the same patch of grass multiple times in one game but make it random every time

avatar image Aequitas2116 Jan 08 '19 at 02:54 PM

More along the lines of B. I want the spawn in the encounter level to be random every time.

avatar image Nebula Games Inc Jan 08 '19 at 06:36 PM

Also why is this all running off tick??

avatar image Aequitas2116 Jan 08 '19 at 07:30 PM

It was running off tick because I'd resorted to trial and error. I'd originally had it set to beginplay, but was wondering if I had it set to tick that I could have it check to generate a new float every time I entered the level. Not ideal, obviously, but I wanted to try and find some way (even an awful way) to make things work before I asked for help.

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

1 answer: sort voted first

Hello, all you have to do is change the 'random float from stream' to 'random float'. The reason that is wasn't working was because once it had been triggered it was using the same float again instead of generating a new one. alt text

Hope this helps, Harry

sniiip.png (61.2 kB)
more ▼

answered Jan 08 '19 at 05:14 PM

avatar image

33 2 2

avatar image Aequitas2116 Jan 08 '19 at 07:34 PM

That makes a lot of sense! Now I feel a little silly haha.

Thank you so much for the info and especially the picture. Such a huge help :)

avatar image crazyhooligan77 Jan 08 '19 at 10:25 PM

Your welcome. Good luck :)

(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