Download

Arrays, Oh darn it, Lost the thread my issue was in

I couldn’t find the post that my issue was in because I wasn’t able to locate where it is. So I have to post it again. An example was shown to me how to do it in blueprints using a Print String Node. But I need the example done instead either using a Widget Text Block or Draw Text Node. For I am a visual guy, so I need to see the blueprint node set up to see how the array is set up. Now the Print String Node is for debugging purposes with the editor only, so when you pack up the game its not gonna show up for its only for the editor… That’s the reason why I can’t use the Print Screen node for the array. But the guy who showed me only knew how to set this up with the Print Screen Node.

I have been using the HUD for displaying my text dialog with using those text blocks as I already made a test map. So i’ve already got the dialog working for displaying simple dialog text blocks when you walk into the trigger near an npc to interact with them, got the interaction working… but I want the npc to also beable to choose its responses
and to do that I need to store the responses inside an random interger array.

Once I can get a basic array working in the Blueprints, Eventually I will need to add also the game choices also into the dialog (I don’t know how to do choices in widgets yet). And lastly when I can get all that going, I need to store all my game variables in a big database file or something, as its a complex game with over a hundred systems but for now, I just want to resolve one problem at a time. starting with getting a basic array working in the blueprints so I can start putting my dialog system into Unreal. Because I’m not an Unreal
Blueprint Programmer is why I’m having struggles getting my script code converted over into
Blueprints. Most of my script is all full of arrays.

The array.

set spin=0
set /a spin=%random% %%4+1
if %spin% EQU 1 echo. Greetings.
if %spin% EQU 2 echo. How are you
if %spin% EQU 3 echo. What’s new?
if %spin% EQU 4 echo. Nice day.

The script example array will just output 1 line at random of any of the above 4 greetings when its run. Its just a simple script that endlessly recycles around the responses at random as you need to put that with some of your npc’s in the game to allow them to have personal opinions. But I need to get Unreal Engine to do the same thing with the blueprint nodes like this script is doing with the above text example.

If anyone can show me the set up for the array I need it will be much appreciated.

I assume this is the thread you are referring to: Oh i still haven't figured this out yet. Array for Interactive Dialog - Blueprint Visual Scripting - Unreal Engine Forums

I would suggest making a Object Macro Library and create a macro that returns random array item. I will show you how. :slight_smile:

First right click on Content Browser and select Blueprint Macro Library from Blueprint section:

&stc=1

Then select Object class from the resulting window:

&stc=1

Create a new macro and name it Get Random Item From Array. Then make a new wildcard input parameter and set its type to array:

&stc=1

Finally create a network like this:

&stc=1

Now you can reuse this array in any class with any array type (thats the beauty of wildcard input). For example, you can use this to get random text/string from a text/string array

&stc=1

&stc=1

Hope this helps. :slight_smile:

Ok I’ve now created the new macro.

Before I was using Text Block Widgets for doing my hud dialog. This is how I had set it up in the blueprints, I know its incorrect
in places because I aint an experienced blueprint programmer, but it did work somewhat to get the widget to display the text and
play the audio at least but I also knocked out the whole entire hud out in the process after the audio had played. lights out, oh joy).

Screenshot of the setup is here.

https://i.imgbox.com/K43G7M7E.png

Its no fun I knocked out the whole hud afterwards everytime I went to display dialog. All because I couldn’t get remove from parent to show because I didn’t know how to reference the widget that I wanted removed due to lack of experience.

Now I see you have a set text array and also a draw text array, I need to see whats inside those two text array nodes called ‘My Array of texts, and my array of strings’ so I can see if they are using the same exact text to define the array with…

Once the array list is working for displaying the text. The second task is then to get the audio dialog to play with the text that the array picks.
That I don’t know how to set up yet.

Other things still to figure out.

TRACER GUN DOSENT DAMAGE MY DROIDS YET. I’ve still yet to figure out how to add in the collision code to my
Tracer Gun blueprint code so the gun can beable to damage and destroy the droids. As I don’t know where in the blueprint
the code it has to go…

MINI MAP WOES - THE MAIN REASON WHY I DON"T LIKE FOLLOWING UNREAL YOU TUBE TUTORIAL VIDEOS - is because
some of these guys who do these videos sometimes like taking little SHORTCUTS here and there with adding in a pre-defined set of
functions or macros to save themselves time. Which means that unless you know how to construct those functions they are cutting
and paste, then you are left with a broken code and broken promises as a result. They’re supposed to provide a bridge. But what good is it
providing a bridge to help others to cross if the bridge itself is creaking, either hanging by a thin thread of riope, or has has got gaping big holes
in the floorboards. So the noobs all fall through the gaps. Mind the gap…

Next time you have an issue with a YT tutorial, consider posting URL at current time here, surely someone will be able to help you.

…]Now I see you have a set text array and also a draw text array, I need to see whats inside those two text array nodes called ‘My Array of texts, and my array of strings’ so I can see if they are using the same exact text to define the array with……]

The array contains exactly what you put inside, select the variable and look at the *Default Values *at the bottom:

@tozan, about the minimap woes - do you want a HUD class minimap or a UMG minimap? I have found good tuts (that I personally used) for both and could send you the link to whichever you want.

Link to tutorial video if it still works

Here’s the screenshot of the correct code setup with the CAST TO BP CHARACTER NODE LINKED.

https://i.imgbox.com/AeeyqsKJ.png

And this is the result I got instead with my engine version. Which is 4.12.5

https://i.imgbox.com/UxXxF8bV.png

A Blueprint Compiler Error because I couldn’t find the Cast to BP Base Character node. With 4.12.5
they may have removed it so I couldn’t connect up the camera targets… I wish they just keep the old nodes
intact to support the older engine versions instead of removing them from the list because it ends up
breaking the bluepriints in these tutorials and you need programming knowledge to restore back the
missing node if its not found in the list…

No, the node wasn’t removed.

You have two options. 1) Drag from get follow rot to the node you’ve got in your screen and from it to branch (aka make more white connections). Option 2), right click on the node and click ‘convert to pure cast’.

Ok thanks for your help. But why is this never ever mentioned to us in the YT tutorials? I’m spending more time in troubleshooting engine issues and blueprint problems than I am in making my game. This is no fun at all. For a good robust game engine, I’m surprised at the amount of headaches that you have to go through to get anything decent done in it.

This is what happened when I tried to create your macro from inside my own game blueprint. I
ran into incompatability pin troubles. This should not even be happening, but that’s what happened so what did you do
different to get all those Square Array symbols to show up on your wildcards? Because its not even showing
them on the Input node when i created the macro from inside my own game blueprint. So is this an array macro
that only works from outside the game blueprints? Because it won’t work from inside my own blueprint I
run into compatibility pin troubles. The string node won’t accept the pin…

And if the macro only works by creating the macro separatly from my main game blueprint, then I need to know how to
get the macro to show up in my node listing so i can add it to my blueprint if I can’t create the macro from inside
the game blueprint.

You need to make position 0 a single string, not an array of those. Click on the rectangle next to the variable type dropdown.

Ok conveting to Pure Cast worked for that node, but I still don’t know how to get that big long Red Boolean Node with the Blue Target Pin on it, because the problem is I have a Third Person Variable node but it only has just 1 pin connection on it. Not two, so there’s no target pin and you need the target pin to connect it to the camera node.

Its just endless little issues with Unreal. Its not the Giant Redwoods that trip us all up, its the little twigs and branches.

Ok I got the Wildcards Array Macro now assembled. What I want Unreal to do is this.

Soon as you activate your trigger by stepping into it, (the trigger will only activate just once using a DO ONCE node)
Unreal will then SHUFFLE around a small group OF UMG Text Block Widgets inside of an array and then display one
of them up in the hud.

So How do we code Unreal so it can shuffle Umg widgets in an array using only one on overlap trigger?
I’m not sure how to go about it. I know how to display a text block widget up in the hud but not how to put them inside of
an array to shuffle them. The closest thing I have to it is the sequence node but that only runs things down in
a sequential order, it don’t randomize the inputs pins. The Shuffle Node only seems to deal with shuffling strings and numbers.
Not widgets. Unreal should have a checkpoint option called Randomize on the sequence node which would
save me some trouble if I could just create the pins and just link them up to the widgets I need to shuffle but it don’t have that option.

But I need something that can link up to the widgets to shuffle them.