How to add a for loop to this?
This is the whole blueprint (inside the event graph of a blueprint class - actor) It spawns the actor and applies a position transform. How can I add a for loop to this, when it uses Event Tick (it will crash UE4), to loop a spawn command to spawn the actor in the blueprint class indefinitely (add a delay for the loop, but no delay for the event tick b/c that will slow down the position transform).
Any help would be greatly appreciated!
asked Oct 18 '15 at 02:48 AM in Blueprint Scripting
So I found a solution:
The spawn point was set using TargetPoint I did use EventTick for implementing my for loop -> delay (which delayed the tick to every 2 seconds, as I put in the delay node) -> spawnActorFromClass
Because the actor has a ProjectileMovementComponent, it would move in a coordinate direction without the help of the orange spawnTransform on the spawnActorFromClass (which was just set to the TargetPoint to place its spawn position)
Without the delay after the for loop, the Event Tick caused this to happen:
Hi man , if i get what you want :
Take your actor , and make a CustomEvent, call it SpawnWithDelay. Make your customevent spawn the actor, then add the Delay node, and put in appropriate value, then call again your custom event.
in the Event begin Play, call your customevent
This Spawn endlessy your actor , but you can change the value of the delay to get the right time.
In the event tick of your spawned actor, via blueprint, add a simple " Add Actor Relative Location" to make it go endlessy in one direction .
answered Oct 18 '15 at 09:52 AM
you have to pay attention when use SET or ADD location/rotation.... Set will define the amount you give, Add will add that amount. look here all these nodes will move toward the X.
answered Oct 18 '15 at 06:33 PM
Unreal crash because your actor ProjectileTest create a duplicate of himself, that begin play , and create a duplicate of himself to endlessy.(without never reaching the first delay)
You have to call your spawn event , from outside your ProjectileTest. you can place this in your level , or in another actor.
but the ProjectileTest absolutely must not spawn himself.
Actor A (gun) have the on begin event -call customeventSpawnBullet
Actor A have the custom event SpawnBullet , that spawn a bullet and re-call this event witha delay.
Actor B (the bullet) have nothing inside himself.
answered Oct 18 '15 at 09:37 PM
I didnt understand what you commented here.
Unreal implement loops of many types.
ProjectileMovementComponents doesnot need any info in the event tick
You can spawn Actors everywhere. giving him coordinates manually or picking them up from other Actors.
You can also spawn dozen of Actors with physics or projectilemovement component at evey frame.
i am sure that unreal can handle what you want to do, if you do it fine. Unreal just crash if you endlessy create Actors that create Actors endlessy without pass a single frame. try to rebuild my example above , keep it simple. one step at time.
answered Oct 18 '15 at 10:02 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here