Replace Substring with Image on a Widget

Hi,

I’m trying to create a Killfeed Widget with a Headshot image incorporated in it.

I’m getting all the information with a String variable, which consists of:

  1. Killing Player
  2. Weapon used
  3. Headshot?
  4. Killed Player

When the player is killed with an headshot, it adds [HS] to the string - now I’m trying to replace the text [HS] with an image but I’m having some trouble:

How can I get the substring > Return Value to Original object > Get/Set Position of Headshot image?

Thank you.

I see what you’re trying to do but shifting icons in the canvas in order to have them match text position will give you a headache sooner than later.


Consider the following approach with 2 widgets:

wKillFeedEntry

  • this widget represents a full line that can be added to another widget
  • it has an image and text
  • the goal is to add one per kill to another container

It also has the following script in the graph:

  • the custom event updates the 2 elements mentioned above (image & text)
  • also, if there was a headshot, we format the text slightly differently
  • the argument list on the far left is case sensitive

wKillFeed

  • this widget serves as the container for the entries
  • the goal is to have the entries added to a scroll box

Its graph looks like so:

  • calling the custom event creates a new entry widget
  • the newly created entry is updated with appropriate passed details
  • we then add it to the scroll box and scroll to the bottom, to show it

It can be called like this:

  • from now on, whenever you need a new line added to the kill feed, call Add Kill Feed Entry and provide data
  • here, at the bottom, the data is debug-simulated and can be ignored, ofc

The end result:

Image from Gyazo

Link to the project:

Another alternative is to set up rich text but that’s somewhat too involved for something like this.

Thank you, works great this way :slight_smile: