Add GetCharacterName() to retrieve an NPC's name as defined in its dialogue script, if it exists. Otherwise it will just return the same output as GetTag().

This commit is contained in:
nashmuhandes 2021-03-16 04:03:32 +08:00 committed by Christoph Oelckers
commit b28e5cb917
4 changed files with 28 additions and 0 deletions

View file

@ -814,6 +814,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, GetTag, GetTag)
ACTION_RETURN_STRING(res);
}
static void GetCharacterName(AActor *self, FString *result)
{
*result = self->GetCharacterName();
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, GetCharacterName, GetCharacterName)
{
PARAM_SELF_PROLOGUE(AActor);
FString res;
GetCharacterName(self, &res);
ACTION_RETURN_STRING(res);
}
static void SetTag(AActor *self, const FString &def)
{
if (def.IsEmpty()) self->Tag = nullptr;