Syntax for setting struct

Hello,

I can’t seem to figure this out; what is the syntax for setting a struct in c++? In blueprints we have nodes for breaking and making structs, but how do you do this in c++? The reason I need this is because I have a struct called FlagPossession which among other things contains another struct, called FlagPossessionProgress. This FlagPossessionProgress contains an enum and an integer. How would I approach setting the variables inside of FlagPossessionProgress? Because FlagPossession.FlagPossessionProgress.EnumName doesn’t work.

EDIT: I forgot to mention that FlagPossession is an array of the struct FlagPossessionProgress.

Could i see your code? Because that is exactly how you would access a property in a struct.

Correct, you have to specify an index whenever working with arrays.

Visual studio intellisense errors are actually very inaccurate when dealing with ue4, its recommended to not pay too much attention to intellinsen errors and even turn it off completely and use visual assist x.

If it builds and works then you are probably fine.

Hmm, you are probably right…

Btw I forgot to specify that the FlagPossession var is an array of struct FFlagPossessionProgress, and that may be why it didn’t work for me, as I need to specify the index of the element I want to set, right?

Anyways, I don’t have my old code but I can show you my code that kinda works (It is setting the values although I’m getting red lines below the integer-values, or the 0s, but I get no errors). Here’s the code I’m using to set default values in my actor’s constructor (Should be the same syntax outside the constructor aswell):

FlagPossession.PossessionStatus.AddDefaulted(3);

FlagPossession.PossessionStatus[0] = FFlagPossessionStatus
{
	ETeamsEnum::TEAM_Wilderness,
	0
};

FlagPossession.PossessionStatus[1] = FFlagPossessionStatus
{
	ETeamsEnum::TEAM_Blue,
	0
};

FlagPossession.PossessionStatus[2] = FFlagPossessionStatus
{
	ETeamsEnum::TEAM_Red,
	0
};

Any clues on why I’m getting red lines below the 0s? If this is helpful, here’s my FFlagPossessionProgress structure:

USTRUCT(BlueprintType)
struct FFlagPossessionStatus
{
    GENERATED_BODY()

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Flag")
    ETeamsEnum Team;

    UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Flag")
    int32 PossessionProgress;
};

Thanks for your help, it’s highly appreciated!