Add FindClass and Eval function:
Add to MMOUtility.h:
UFUNCTION(BlueprintPure, Category = "MMO Utility")
static UClass* FindClass(const FString& ClassName);
UFUNCTION(BlueprintPure, Category = "MMO Utility")
static float EvalMathExpression(const FString& expr);
add to MMOUtility.cpp:
UClass* UMMOUtility::FindClass(const FString& ClassName)
{
check(*ClassName);
UObject* ClassPackage = ANY_PACKAGE;
if (UClass* Result = FindObject<UClass>(ClassPackage, *ClassName))
return Result;
if (UObjectRedirector* RenamedClassRedirector = FindObject<UObjectRedirector>(ClassPackage, *ClassName))
return CastChecked<UClass>(RenamedClassRedirector->DestinationObject);
return nullptr;
}
double ParseAtom(char*& expr) {
char* end_ptr;
double res = strtod(expr, &end_ptr);
expr = end_ptr;
return res;
}
double ParseFactors(char*& expr) {
double num1 = ParseAtom(expr);
for (;;) {
char op = *expr;
if (op != '/' && op != '*')
return num1;
expr++;
double num2 = ParseAtom(expr);
if (op == '/')
num1 /= num2;
else
num1 *= num2;
}
}
double ParseSummands(char*& expr) {
double num1 = ParseFactors(expr);
for (;;) {
char op = *expr;
if (op != '-' && op != '+')
return num1;
expr++;
double num2 = ParseFactors(expr);
if (op == '-')
num1 -= num2;
else
num1 += num2;
}
}
double EvaluateTheExpression(char* expr) {
return ParseSummands(expr);
}
float UMMOUtility::EvalMathExpression(const FString& expr)
{
return (float)EvaluateTheExpression(TCHAR_TO_ANSI(*expr));
}
Credits:
https://www.strchr.com/expression_evaluator
I Simply Updated the Scripts / made them available in Blueprints.
For Unbugging the Char Preview:
First follow this tutorial:
After that change the Blueprints like that:
-
Add a Static Mesh Component to the “Studio” (to the position where your Char should be) and call it Book.
-
Add a Variable called “Actor” with type ModularPlayerActor Reference
-
add A function “BuildChar” -> BuildChar posted by anonymous | blueprintUE | PasteBin For Unreal Engine
-
Save and Compile the Script.
-
In MMOPlayerController add a variable called “Renderer 2D” with the type of your new blueprint class.
-
Make the EventGraph of MMOPlayerController look like this: http://i.epvpimg.com/wqlBc.png
-
Add the Call to create the “Studio” in BeginPlay : http://i.epvpimg.com/sZode.png
Basically it now works. But you have to Add the Updating Equipment , too. Otherwhise it will only refresh on reopen the Equipment Window.