Download

Getting an integer from a string?

I have a target launcher that spawns and launches a target blueprint. I’d like to be able to establish the order in which the targets were spawned, so I can then establish which target was hit first.
It’s for a clay shooting game. Certain clay games require targets to be shot in order, and I’m not sure how to go about creating this.
So far I have GetObjectName, from Spawned Actor, sent to a string array, but don’t know how to extract the integer value from the spawned actor string.

Eg. Clay_Regular_BP_Child_C1 Clay_Regular_BP_Child_C2 .etc. I only need the integer from the last character of the string.

Any help would be greatly appreciated. Cheers.

I wouldn’t rely on that too much.

Why not create an exposed int variable in the Target, it will serve as the Index. Keep a counter in the *Launcher *and increase it by 1 before spawning the Target. Feed the *Target *current counter value. You can then read Target’s *Index *without fiddling with the name.

Thanks, that makes sense. I’ll give it a try.

Thanks Everynone. That solved my problem. I set the ID var before spawn. Top geezer. Cheers.