Implementing functionality

To have license plate working properly, we now need to setup some blueprint logic after design was created.

Head into the graph part of widget editor:

In Event Graph right click and search for “Event Init Text Boxes” as follows:

Next, drag in all Text boxes from Variables section of the Blueprint (by default on left side)

Dragging from one of the nodes, choose option to make array, after which you need to plug in all text boxes into said array.

Once connected, drag from the array node and select option “Set Text Boxes”

From node Set text boxes, drag white line and select “Bind Event to On Text Changed”

As target select one of the textboxes that you want to have changable functionality. After that, create custom event by rightlicking and selecting “Add Custom Event”

Click on the newly added Custom event and on the left side in details, add Input parameter called “Text” , which is Text string variable

Once created, it is neccessarry that the “Pass-by-Reference” tickbox is ticked

 

Dragging from the white line of Custom Event select function “Trim Text”. Here you need to plug in the editable texboxt box once again as its textbox. In the function Trim Text you also need to set how many characters the textbox can contain, as well as which characters are valid (for example here, player can input only letters and not numbers).

This step of custom events and binding the event on text changed, needs to be repeated for every editable text box in the blueprint. In our example, we have just two. This is the full logic of Text Boxes

Finished logic for Initializing Text Boxes

Once done, we need to add yet another event into the Event Graph. Rightclick and search for “Event Set License Plate Text” as follows:

From the white line drag and search for function “Set Text Box Contents” and confirm the selection. Connect Text Box Contents with Plate Data if that did not happen automatically.

From node “Set Text Box Contents” drag the white line and select function “Init Text Boxes”. With that, the logic for setting text is done.

Finished logic for Setting License Plate Texts

To achieve correct drawing in game, we have to override function “Get License Plate Draw Size”. You can do so by hovering over functions and clicking on Override, then selecting said function as follows:

This will open new function. We will now here set the sizes.

Drag in Size Box from the Variables part into the editor. From that node, we need to get Width and Height of said component. Simply drag from the blue node and search for “Width Override” and select “Get Width Override”. Do the same also for Height

By dragging from the Width Override, we select option to “Make Vector 2D” which creates X and Y sizees. Plug the Width as X axis and Height as Y axis. Once done, connect that vector into the return node. With that, the blueprint part is done.

 

Step 3: https://stillalive.atlassian.net/wiki/spaces/BSM/pages/574193714