Download

How do I execute two tasks at the same time

I have a sequencer that has two outputs and it only does one at a time. I need something that executes the two outputs at the same time. Is there anything that could execute the two outputs at the same time or is it impossible for blueprint scripting to do that?

Blueprint has to execute everything in an order, so no, you can’t do that. What do you need it for though? I’m sure there’s another way of doing it.

Yep, basics of computer programming, you CANT execute two separate tasks at the same time.

I have a endless runner game with a choice of turn. You can turn left or right, but I need to spawn the connecting tiles on both sides of the turn at the same time. Is there anyway of coding that in C++?
http://imgur.com/a/arF34

Would there be a way to make two different functions and call them to execute at the same time?

The game thread will run through all necessary code until it’s done, then update the frame. So if you first spawn the left tile and then the right tile, they will both appear for the player at the same frame, simultaneously, even if one tile was created a little bit earlier from a code perspective.

That said there may be coding reasons why you’d want to be sure that some things exists before you do the next thing.
But what if you add a third pin to your sequencer.
0 -> spawn left
1 -> spawn right
2 -> do whatever it is that requires the two tiles to exist.

I don’t understand. this is my code.
http://imgur.com/a/9EdOi

I don’t know how to help you. What are you trying to achieve and is there something not working with the setup that you currently have?
If you want two tiles to appear (from a player perspective) at the same time, that blueprint is going to work fine.

Look this is only what spawns with the blueprint
http://imgur.com/a/C4nvw

There could be three reasons I can think of;

  • Some cast failed. Put a print string after the cast failed nodes and see if it’s printed.
  • Is it possible that you’re actually only spawning one tile? the function only spawns one actor, so if you call that function only once then only one tile is spawned.
  • The spawned tiles are overlapping. This may happen if there’s some flaw in the setup, making the tiles spawn at the same place so that they overlap perfectly. Though then there should be some flickering going on.

I tried to call it twice but it still doesn’t spawn the other side of the turn.
http://imgur.com/a/zrHco

hard to tell with what little bit of code you posted but looks like you are spawning both of them in the same location - [next spawn point] is set / used for both

first thing i’d check anyway ^^^

  • you can use a print string to see if they are the same or just watch the values to find out -

Ill try thxs

I got a second spawn point, but only one spawn point can be plugged into the spawn actor at a time. Any ideas?

seems like you may need to do more tutorials or examples - takes time to learn all you can do in the engine

good place to start is to use google search & the docs: https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/FlowControl/

things like the [flip flop] node

Unreal as well as game dev is a learning process, always learning. no matter who you are. just keep trying & testing & researching your options.

Hello,
I may be wrong (as i haven’t use the engine for long) but for me the trouble is that you not try to execute two tasks but you try to execute the same task twice. I would use two spawnactors to have two actors spawned.

I already tried that and it did not work it spawned tiles all of the place. Thanks though.

Sadly none of the flow control nodes will help with my issue it is really annoying because my game has to have a corner turn like temple run. Anybody else have any other ideas???

@richardsonsam ok… ok. yeah I was just trying to get you to think about what you wanted to do by following the way your code flows or the order your code will execute

think about the sequence node you have which actually just does what it says, as soon as 1st output finishes it executes the 2nd line of code. this happens pretty darn fast

so if you want to spawn both sides - you’ll need 2 spawn actors - 1 coming from the 1st output & 1 coming from the 2nd
(you can use a [Print String] node with a message so you can tell whether or not they both are spawning, for instance)

(you’ll have to figure out their proper spawn locations from there)

oh & not sure if you’re following a tutorial or what but this series may be of some help if you haven’t seen it yet:
https://docs.unrealengine.com/latest/INT/Videos/PLZlv_N0_O1gbY4FN8pZuEPVC9PzQThNn1/