Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to get a the Suffix of an item?

Hi there,

I am trying to create an achievement system in the game and I want the script to be reusable for all the text so I don't have to manually input it. So I have a Data Table with all the achievement information on it and on my widget I want the text to find the correct row on the data table and display the name of the achievement.

My Data tables are names 00, 01, 02 etc. and my achievement text objects are named Achievement_00, Achievement_01, Achievement_02 etc. I want to create a binding, and in that binding will be a script that will reference the self, get the name of the self. The part I don't know how to do is to get the suffix (the number), which will then call the correct number in the data table.

Any ideas how to get this to work?

Thanks in advance

Product Version: UE 4.20
more ▼

asked Nov 02 '18 at 06:16 PM in Blueprint Scripting

avatar image

46 2 1 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

There is a node that splits a string into an array of strings, breaking it at the character or character sequence you indicate. I think it's called "Split" (which only splits once into two pieces - there's another one called Parse String Into Array or something like that which does it multiple times).

YOu could use the underscore character "_" as your splitter, and then just get array index 1 to grab the suffix number you just split off from the original string.

more ▼

answered Nov 02 '18 at 06:48 PM

avatar image

3.8k 18 20 20

avatar image Tisreece Nov 02 '18 at 06:52 PM

Perfect, this is exactly what I wanted. I knew this existed somewhere, I just couldn't remember the name of it.

Many thanks :)

avatar image Tisreece Nov 02 '18 at 07:06 PM

Okay turns out I haven't entirely thought this through. You wouldn't happen to know how to call the correct text to find the correct row, currently my setup wouldn't work to apply to multiple pieces of text.

I was hoping to reference the self, but the self is the widget rather than the text that was using the binding at that momentalt text

currentsetup.png (107.4 kB)
avatar image mightyenigma Nov 02 '18 at 07:25 PM

I don't fully understand. Are you always getting the ERROR returned instead of the data table row and name from the struct in that row?

avatar image Tisreece Nov 02 '18 at 08:10 PM

No no sorry, that part of the script is working fine, but atm only TextAchievement_00 is getting fed into it. I'm looking for a way where this text binding can be applied to all my TextAchievements without having to create a binding for each individual one. So I could use the same binding for TextAchievment_01 and it would automatically find 01 in the Data Table.

I am not sure if what I am asking is possible to be honest, I just know there is a more efficient way of doing this without creating an individual binding for all my achievements.

avatar image Tisreece Nov 02 '18 at 08:31 PM

Okay I'm dumb as hell. I didn't need a binding at all, instead i'm assigning it to event Construct.

Just in case anyone needs to know, this is my current setup that works and can be used for everything in my list.

Thanks for the help Mightyenigma, really appreciate it :)

alt text

currentsetup2.png (79.7 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question