Announcement

Collapse
No announcement yet.

UE4 - How to get 1 actor with tag, then change his location? image attached

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    UE4 - How to get 1 actor with tag, then change his location? image attached

    Hi, i have 20 actors of the same BP type, each one has a different tag from tag1 to tag20, if i need to find the actors with tags from Tag5 to tag10 in order, not all at same time, how can i do it?

    I attached a pic, the system chooses specific tags from a list of tags, and out that actor.... until here, no problem, but, there is no way to choose this single actor and set a location directly because the blue connection cant be attached to "set actor location" as object... so, i need to set a variable, even for each loop, and it becomes confusing; so the system sometimes works, sometimes finds the actors in disorder (first Tag8, then tag5, then tag9), or it takes them all at the same time and creates them all at same time....and i need to change their location in order: Tag5, change loc. then tag 6, change loc. then tag7, not all at same time and other times, it relocates nothing.

    Please urgent help and share a BP pic if possible
    Attached Files
    Last edited by DraxFX; 08-01-2020, 06:23 AM.

    #2
    Originally posted by DraxFX View Post
    Hi, i have 20 actors of the same BP type, each one has a different tag from tag1 to tag20, if i need to find the actors with tags from Tag5 to tag10 in order, not all at same time, how can i do it?

    I attached a pic, the system chooses specific tags from a list of tags, and out that actor.... until here, no problem, but, there is no way to choose this single actor and set a location directly because the blue connection cant be attached to "set actor location" as object... so, i need to set a variable, even for each loop, and it becomes confusing; so the system sometimes works, sometimes finds the actors in disorder (first Tag8, then tag5, then tag9), or it takes them all at the same time and creates them all at same time....and i need to change their location in order: Tag5, change loc. then tag 6, change loc. then tag7, not all at same time and other times, it relocates nothing.

    Please urgent help and share a BP pic if possible
    If you tag them with 1 - 20 it's much easier because you don't have to take the 'tag' word off first.

    But then you basically need to sort the array by tag and then use it.

    To sort the array you need two things, a function that will give you the highest tag, and a function that will loop through the array repeatedly taking off the highest tag ( using the first function ) and store it in a temp array.

    When you get to the end, the temp array holds the sorted array.

    If you don't fancy that, you can get a copy of

    https://www.unrealengine.com/marketp...andard-library

    which sorts arrays for you. It will sort them by anything you like, but if it's something non-standard like this, you have to write the comparision function for it.

    If you want to take the first route, quote me, and I'll write a bit of code if you're stuck.

    Comment

    Working...
    X