# I need to know how to set up a basic array with Blueprint Widget Objects

**URL:** <https://forums.unrealengine.com/t/i-need-to-know-how-to-set-up-a-basic-array-with-blueprint-widget-objects/76061>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [October 15, 2016, 9:23am UTC](https://forums.unrealengine.com/t/i-need-to-know-how-to-set-up-a-basic-array-with-blueprint-widget-objects/76061 "2016-10-15T09:23:14Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ste1nar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ste1nar](https://forums.unrealengine.com/u/ste1nar)\
**Post date:** [October 16, 2016, 11:14am UTC](https://forums.unrealengine.com/t/i-need-to-know-how-to-set-up-a-basic-array-with-blueprint-widget-objects/76061/4 "2016-10-16T11:14:11Z")

</div>

So in the windows script, it just selects a random int and based on that, an associated string is displayed. And that’s the array, not an actual array class?  
Instead of using a bunch of If statements, a switch: case statement would also have worked. And that you can use in UE:  
 ![switchonint.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/1/b/1bf46eeb0dacaf30890d7f5f6056c8ad2c376da6.png)

Here’s the thing. Doing a sequence of flip flops, sure it could work. But for dozens of items it seems like a big mess. If you wish to change something or troubleshoot, it could be quite the ordeal.  
Also, having text in textblock widgets won’t allow you to localize easily if that is something you plan to do. Then the dialogue needs to be in text variables.  
Either way, I suggest trying to find a more structured way of doing things.

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

This tutorial from Epic shows how to create a simple dialogue system, though it does not seem that amazing.  
Another project which seems really cool is [Dialogue System - Game Development - Unreal Engine Forums](https://forums.unrealengine.com/showthread.php?88313-Dialogue-System)  
where you can download the project and dive into their blueprints.

The most crucial thing for you to consider, I think, is the use of the widgets. Do you really need to have each dialogue in a different widget, hardcoded with textblocks? You could have just one widget that displays the dialogue, depending on a text variable.

Something that might be useful is the use of data tables. Data tables needs one type of struct class which determines what information the data table can hold.  
I think you said you have spoken dialogue, so associating each sentence with a sound file would be easy.  
 ![switchonint.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/f/2/bf219098c75ec36d5dbfe0b07f323191b0abbe07.png)  
This data table has the following struct

 ![DatatableStruct.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/c/e/ce7214b9ab5c6db8eb268073a0eeb0b99c5389d9.png)

Using Data tables has their own challenges and two things to know is that you can not modify a data table (at least not using blueprint) during the game, and that the way you get to the data in the colums is by inputing the exact Row Name.  
 ![Datatable1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/1/0/a10d42a9d0a1a29160b677175e1a791be631a170.png)

In the example above, using random int we can do something like…

 ![RandData.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/7/3/73f1b5a133b12bb41c8d89985f9163171cdae682.png)  
So instead of using the whole flip flop thing, or a switch on int, this is pretty much all we need to select the desired dialogue.

And more, the struct can hold widget classes in case you still want to go with that instead of a text variable.

 ![DataWidget.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/d/f/df6c69b95c695a35f64ccf504beb70d5e5755704.png)

---

_[View the full topic](https://forums.unrealengine.com/t/i-need-to-know-how-to-set-up-a-basic-array-with-blueprint-widget-objects/76061)._
