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).
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 .
First, you get the error in red , as unreal say: The spawn in your spawn event, need a transform. you need to tell him where put the new spawned actor and wich rotation and scale give him.
so pin out from the, and say him make transform, and complete all the pin , give him a location , a rotation , and a scale, you can make them all manually or take them from other Actors.
I suggest you to try to use at first, an actor without complex component.
and see if you can spawn that Actors as you want.
Using the projectile movementcomponent, mean that your projectile will fall for gravity, slow for air , have a velocity an accelleration and a lot of thing.
you will probably take a few times to get what you want.
if you want that your projectile go steady in a direction
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.
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.
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.
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)