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!!!


264495-

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

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

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.

Hope this helps,
Harry

Also why is this all running off tick??

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.

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 :slight_smile:

Your welcome. Good luck :slight_smile: