Help! How to set a bool to String in C++?

I am trying to do this in C++ but I don’t know how?

temporary using Ukismet Library: How to do it without using Ukismet Library

BoolToString = UKismetStringLibrary::Conv_BoolToString(bRotating);
RotatingObject = BoolToString;
1 Like

Well, there’s the “old fashioned way”:
return (bool_expr) ? “true” : “false”;

4 Likes

Thank You for helping…

bool_expr is the string variable?

I will doing something like this.

No, that’s the non-string value you want to evaluate as a bool, then return a string representation for. Usually for logging purposes i.e. UE_LOG(), but it could be for UI display…

yes , and it will process a data table contain the value for the character state pose.

inside the data table , appending all the conditions

FString HoldWeapon = UKismetStringLibrary::Conv_BoolToString(_bHoldWeapon);

if (bCrouching)
	{
		Posture = FString(TEXT("crouch"));
	}
	else if(bProne)
	{	
		Posture = FString(TEXT("prone"));
	}else
	{
		Posture = FString(TEXT("stand"));
	}

if (bAiming)
	{
		MoveState = FString(TEXT("aim"));
	}
	else if(bWalkPressed)
	{	
		MoveState = FString(TEXT("walk"));
	}
   else if(bRunPressed)
	{
		MoveState = FString(TEXT("run"));
	}else
	{
		MoveState = FString(TEXT("jog"));
	}

Alexa, it looks to me like you already know what you are trying to accomplish and have thought through how to do it.
I think if you are asking for help, you’ll need to be more specific about what it is you don’t understand, or are perhaps asking for suggestions on.

Have you reviewed state machines?
https://docs.unrealengine.com/5.0/en-US/state-machines-in-unreal-engine/

1 Like

Yes I have all the state machine sets up already.

What I want to do with these strings and data table is to control the character speed in different positions states.
Just appending the assigned states from data table by name and setting the state of the character.

This APPEND DATA TABLE is the part of this achievement in blueprint, currently I want to implement in C++.