1
0

NPC, dialogues

This commit is contained in:
ZetaKebab 2018-09-02 16:15:53 +02:00
parent e4b3dac9ac
commit be2de210af
10 changed files with 350 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -8,10 +8,299 @@ ANPC::ANPC()
PrimaryActorTick.bCanEverTick = true;
}
FString ANPC::GetQuestionLeft()
{
if (NPC_Name == "Zyxel") {
if (NPC_State == 0)
return ZyxelQuestion0_0;
else if (NPC_State == 1)
return ZyxelQuestion1_0;
else if (NPC_State == 2)
return ZyxelQuestion2_0;
}
else if (NPC_Name == "Arthrum") {
if (NPC_State == 0)
return ArthrumQuestion0_0;
else if (NPC_State == 1)
return ArthrumQuestion1_0;
else if (NPC_State == 2)
return ArthrumQuestion2_0;
}
else if (NPC_Name == "Naioli") {
if (NPC_State == 0)
return NaioliQuestion0_0;
else if (NPC_State == 1)
return NaioliQuestion1_0;
else if (NPC_State == 2)
return NaioliQuestion2_0;
}
return "";
}
FString ANPC::GetQuestionRight()
{
if (NPC_Name == "Zyxel") {
if (NPC_State == 0)
return ZyxelQuestion0_1;
else if (NPC_State == 1)
return ZyxelQuestion1_1;
else if (NPC_State == 2)
return ZyxelQuestion2_1;
}
else if (NPC_Name == "Arthrum") {
if (NPC_State == 0)
return ArthrumQuestion0_1;
else if (NPC_State == 1)
return ArthrumQuestion1_1;
else if (NPC_State == 2)
return ArthrumQuestion2_1;
}
else if (NPC_Name == "Naioli") {
if (NPC_State == 0)
return NaioliQuestion0_1;
else if (NPC_State == 1)
return NaioliQuestion1_1;
else if (NPC_State == 2)
return NaioliQuestion2_1;
}
return "";
}
FString ANPC::GetDialogue(bool Left)
{
if (NPC_Name == "Zyxel") {
if (NPC_State == 0)
return GetDialogue_Zyxel(0, Left);
if (NPC_State == 1)
return GetDialogue_Zyxel(1, Left);
if (NPC_State == 2)
return GetDialogue_Zyxel(2, Left);
}
else if (NPC_Name == "Arthrum") {
if (NPC_State == 0)
return GetDialogue_Arthrum(0, Left);
if (NPC_State == 1)
return GetDialogue_Arthrum(1, Left);
if (NPC_State == 2)
return GetDialogue_Arthrum(2, Left);
}
else if (NPC_Name == "Naioli") {
if (NPC_State == 0)
return GetDialogue_Naioli(0, Left);
if (NPC_State == 1)
return GetDialogue_Naioli(1, Left);
if (NPC_State == 2)
return GetDialogue_Naioli(2, Left);
}
return "";
}
FString ANPC::GetDialogue_Zyxel(int index, bool Left)
{
FString ret = "";
if (index == 0 && Left) {
ret = ZyxelState0_0[NPC_CurrentIndexLeft];
if (NPC_CurrentIndexLeft < ZyxelState0_0.Num() - 1)
NPC_CurrentIndexLeft++;
}
else if (index == 0 && !Left) {
ret = ZyxelState0_1[NPC_CurrentIndexRight];
if (NPC_CurrentIndexRight < ZyxelState0_1.Num() - 1)
NPC_CurrentIndexRight++;
}
else if (index == 1 && Left) {
ret = ZyxelState1_0[NPC_CurrentIndexLeft];
if (NPC_CurrentIndexLeft < ZyxelState1_0.Num() - 1)
NPC_CurrentIndexLeft++;
}
else if (index == 1 && !Left) {
ret = ZyxelState1_1[NPC_CurrentIndexRight];
if (NPC_CurrentIndexRight < ZyxelState1_1.Num() - 1)
NPC_CurrentIndexRight++;
}
else if (index == 2 && Left) {
ret = ZyxelState2_0[NPC_CurrentIndexLeft];
if (NPC_CurrentIndexLeft < ZyxelState2_0.Num() - 1)
NPC_CurrentIndexLeft++;
}
else if (index == 2 && !Left) {
ret = ZyxelState2_1[NPC_CurrentIndexRight];
if (NPC_CurrentIndexRight < ZyxelState2_1.Num() - 1)
NPC_CurrentIndexRight++;
}
return ret;
}
FString ANPC::GetDialogue_Arthrum(int index, bool Left)
{
FString ret = "";
if (index == 0 && Left) {
ret = ArthrumState0_0[NPC_CurrentIndexLeft];
if (NPC_CurrentIndexLeft < ArthrumState0_0.Num() - 1)
NPC_CurrentIndexLeft++;
}
else if (index == 0 && !Left) {
ret = ArthrumState0_1[NPC_CurrentIndexRight];
if (NPC_CurrentIndexRight < ArthrumState0_1.Num() - 1)
NPC_CurrentIndexRight++;
}
else if (index == 1 && Left) {
ret = ArthrumState1_0[NPC_CurrentIndexLeft];
if (NPC_CurrentIndexLeft < ArthrumState1_0.Num() - 1)
NPC_CurrentIndexLeft++;
}
else if (index == 1 && !Left) {
ret = ArthrumState1_1[NPC_CurrentIndexRight];
if (NPC_CurrentIndexRight < ArthrumState1_1.Num() - 1)
NPC_CurrentIndexRight++;
}
else if (index == 2 && Left) {
ret = ArthrumState2_0[NPC_CurrentIndexLeft];
if (NPC_CurrentIndexLeft < ArthrumState2_0.Num() - 1)
NPC_CurrentIndexLeft++;
}
else if (index == 2 && !Left) {
ret = ArthrumState2_1[NPC_CurrentIndexRight];
if (NPC_CurrentIndexRight < ArthrumState2_1.Num() - 1)
NPC_CurrentIndexRight++;
}
return ret;
}
FString ANPC::GetDialogue_Naioli(int index, bool Left)
{
FString ret = "";
if (index == 0 && Left) {
ret = NaioliState0_0[NPC_CurrentIndexLeft];
if (NPC_CurrentIndexLeft < NaioliState0_0.Num() - 1)
NPC_CurrentIndexLeft++;
}
else if (index == 0 && !Left) {
ret = NaioliState0_1[NPC_CurrentIndexRight];
if (NPC_CurrentIndexRight < NaioliState0_1.Num() - 1)
NPC_CurrentIndexRight++;
}
else if (index == 1 && Left) {
ret = NaioliState1_0[NPC_CurrentIndexLeft];
if (NPC_CurrentIndexLeft < NaioliState0_0.Num() - 1)
NPC_CurrentIndexLeft++;
}
else if (index == 1 && !Left) {
ret = NaioliState1_1[NPC_CurrentIndexRight];
if (NPC_CurrentIndexRight < NaioliState0_1.Num() - 1)
NPC_CurrentIndexRight++;
}
else if (index == 2 && Left) {
ret = NaioliState2_0[NPC_CurrentIndexLeft];
if (NPC_CurrentIndexLeft < NaioliState0_0.Num() - 1)
NPC_CurrentIndexLeft++;
}
else if (index == 2 && !Left) {
ret = NaioliState2_1[NPC_CurrentIndexRight];
if (NPC_CurrentIndexRight < NaioliState0_1.Num() - 1)
NPC_CurrentIndexRight++;
}
return ret;
}
void ANPC::BeginPlay()
{
Super::BeginPlay();
ZyxelState0_0.Add("I don't see why I would talk about the train. What is there to talk about?");
ZyxelState0_0.Add("Are you even sure it is a train? Don't think about it.");
ZyxelState0_0.Add("No word from me. That's not how I roll.");
ZyxelState0_0.Add("Have you seen those statues? Well you probably have, of course. But aren't they great?");
ZyxelState0_0.Add("I like it here. It's nice.");
ZyxelState0_0.Add("You're getting on my nerves. Why don't we talk about the great statues over here?");
ZyxelState0_1.Add("I am Zyxel.");
ZyxelState0_1.Add("I am just Zyxel.");
ZyxelState0_1.Add("What more is there to know ?");
ZyxelState0_1.Add("I am Zyxel and I am a passenger on the train.");
ZyxelState0_1.Add("I am Zyxel and I am a passenger on the train. That is all.");
ZyxelState0_1.Add("Being a passenger on the train is, apart from my name, the only thing that defines me.");
ZyxelState0_1.Add("Now, stop bothering me.");
ZyxelState1_0.Add("The driver? Why would he come out? He is driving.");
ZyxelState1_0.Add("I don't wanna talk about here. I like it, that's all, and I don't see why I would think about the train driver.");
ZyxelState1_0.Add("Perhaps I am the train driver and it's an automatic train? Now, stop asking me questions. I don't care.");
ZyxelState1_0.Add("What even is a train driver?");
ZyxelState1_0.Add("Why do you even care about the train driver?");
ZyxelState1_0.Add("Don't you have other people to bother on this train? Who cares what or who the driver is?");
ZyxelState1_1.Add("These statues are a fine piece of art.");
ZyxelState1_1.Add("There is not much to do in here, but it is nice. A lot of my appreciation of life comes from looking at these statues.");
ZyxelState1_1.Add("The statues are richely sculpted and decorated.");
ZyxelState1_1.Add("Actually, they are called \"Lucy\".");
ZyxelState1_1.Add("They came from an ancient civilisation.They were pretty popular, and I can understand why.");
ZyxelState1_1.Add("They're absolutely gorgeous.");
ZyxelState1_1.Add("These statues appease my mind. Don't ask me why. They just do.");
ZyxelState2_0.Add("Well, now that you have changed everything, there is no way back. Let's face reality…");
ZyxelState2_1.Add("Actually, I made those statues when I was younger. Things where different back then…");
ArthrumState0_0.Add("It is the train.");
ArthrumState0_0.Add("The train is the train.");
ArthrumState0_0.Add("This is the train. You are a passenger on it.");
ArthrumState0_0.Add("The train is all there is to know. There is nothing more about it.");
ArthrumState0_0.Add("Why, I don't see why I would bother. Being a passenger on the train is the only thing that is.");
ArthrumState0_1.Add("Hi, I am Arthrum.");
ArthrumState0_1.Add("Why, like everyone else, a passenger on the train is what I am.");
ArthrumState0_1.Add("Arthrum, passenger on the train. Hi!");
ArthrumState0_1.Add("Passenger on the train with a name, that is Arthrum. It is what I am.");
ArthrumState0_1.Add("Arthrum, for my name. Passenger on the train for what I do.");
ArthrumState1_0.Add("Zyxel indeed loves the statues.");
ArthrumState1_0.Add("Of course we don't know who put the statues here.");
ArthrumState1_0.Add("Of course we don't know why they put the statues here.");
ArthrumState1_0.Add("Of course we don't know who is \"they\".");
ArthrumState1_0.Add("But why should we care, we are passengers on the train.");
ArthrumState1_0.Add("Perhaps they are his daughters.");
ArthrumState1_1.Add("Why, that is a strange thing to say.");
ArthrumState1_1.Add("I am not the one repeating things over.");
ArthrumState1_1.Add("Passenger on the train, you are rude.");
ArthrumState1_1.Add("You are repeating yourself.");
ArthrumState1_1.Add("Why, Arthrum of his name, is talking normally.");
ArthrumState1_1.Add("It is not.");
ArthrumState2_0.Add("Forbidden things have been said.");
ArthrumState2_0.Add("Time shall not be told. It is a forbidden thing.");
ArthrumState2_0.Add("...");
ArthrumState2_1.Add("Not at all. You have sinned.");
ArthrumState2_1.Add("You have destroyed everything.");
ArthrumState2_1.Add("...");
NaioliState0_0.Add("Ah, well of course, the train is the train! Wanna know more? Of course you do. Though, the train is the train. That's how it is.");
NaioliState0_0.Add("Well, the train is the train. Why would anyone know more than this? Sadly, it's probably no use asking me this over again.");
NaioliState0_0.Add("Nobody knows more than what I told you! At least, not that I know of. Apparently, there's no need to know. Well, it sure is nice here but...");
NaioliState0_0.Add("As strange as it may sound, nobody knows who's the driver. Doesn't he ever take any breaks? I don't have a key to his cabin, though.");
NaioliState0_1.Add("It is a pleasure to meet you! My name is Naioli, and I am a passenger on the train. That's what my life is, as it is for everyone else too.");
NaioliState0_1.Add("I would like to tell you more, but that's just how it is!");
NaioliState0_1.Add("Well, when was I born? I at least know that they told me my name was Naioli. That's an interesting one, don't you think?");
NaioliState0_1.Add("There is nothing more I know about myself. That may sound strange, but anyway, here nobody cares about this kind of things.");
NaioliState1_0.Add("Well, we are passenging, right? That's what is going on here. Easy to figure out, isn't it?");
NaioliState1_0.Add("We are just passenging on the train. Is that a word? I don't know, but it sounded nice in my head. I hope I can still do that.");
NaioliState1_1.Add("Well, we are going to the destination of the train. You are asking a lot of things that have obvious answers!");
NaioliState1_1.Add("We're going where the train takes us. As passengers on the train, that is what we do!");
NaioliState2_0.Add("Well, what does that mean? I'm not sure I understand your question, it's odd. Is there a meaning to it?");
NaioliState2_0.Add("I... I am not sure I understand. I'm just here right? That's what I do...");
NaioliState2_0.Add("What is... \"time\"? This concept does not seem very familiar. Are you sure you're working as intended? You seem to be malfunctioning... I'm curious.");
NaioliState2_0.Add("I'm not sure what I should do or think anymore.");
NaioliState2_1.Add("Going outside? That sounds like a bad idea. Is there something outside? Should we care? Should we even know? I'm not sure I can follow you.");
NaioliState2_1.Add("Is the outside some concept we can grasp? Is it even worth considering?");
NaioliState2_1.Add("What if there's no outside? Would there still be an inside, then? What is the point of anything? Sure, it was easier not asking myself this, but…");
NaioliState2_1.Add("I'm not sure what I should do or think anymore.");
}
void ANPC::Tick(float DeltaTime)

View File

@ -15,4 +15,64 @@ public:
ANPC();
virtual void BeginPlay() override;
virtual void Tick(float DeltaTime) override;
UFUNCTION(BlueprintCallable)
FString GetQuestionLeft();
UFUNCTION(BlueprintCallable)
FString GetQuestionRight();
UFUNCTION(BlueprintCallable)
FString GetDialogue(bool Left);
FString GetDialogue_Zyxel(int index, bool Left);
FString GetDialogue_Arthrum(int index, bool Left);
FString GetDialogue_Naioli(int index, bool Left);
UPROPERTY(BlueprintReadWrite, EditAnywhere)
FString NPC_Name;
int NPC_State = 0;
int NPC_CurrentIndexLeft = 0;
int NPC_CurrentIndexRight = 0;
TArray<FString> ZyxelState0_0;
TArray<FString> ZyxelState0_1;
TArray<FString> ZyxelState1_0;
TArray<FString> ZyxelState1_1;
TArray<FString> ZyxelState2_0;
TArray<FString> ZyxelState2_1;
FString ZyxelQuestion0_0 = "What is this train?";
FString ZyxelQuestion0_1 = "Who are you?";
FString ZyxelQuestion1_0 = "Who is the train driver?";
FString ZyxelQuestion1_1 = "About those statues...";
FString ZyxelQuestion2_0 = "Help...";
FString ZyxelQuestion2_1 = "Those statues... They are...";
TArray<FString> ArthrumState0_0;
TArray<FString> ArthrumState0_1;
TArray<FString> ArthrumState1_0;
TArray<FString> ArthrumState1_1;
TArray<FString> ArthrumState2_0;
TArray<FString> ArthrumState2_1;
FString ArthrumQuestion0_0 = "What is this train?";
FString ArthrumQuestion0_1 = "Who are you?";
FString ArthrumQuestion1_0 = "About Zyxel...";
FString ArthrumQuestion1_1 = "Your way of talking is strange";
FString ArthrumQuestion2_0 = "Are you alright?";
FString ArthrumQuestion2_1 = "Is everything okay?";
TArray<FString> NaioliState0_0;
TArray<FString> NaioliState0_1;
TArray<FString> NaioliState1_0;
TArray<FString> NaioliState1_1;
TArray<FString> NaioliState2_0;
TArray<FString> NaioliState2_1;
FString NaioliQuestion0_0 = "What is this train?";
FString NaioliQuestion0_1 = "Who are you?";
FString NaioliQuestion1_0 = "What are we doing here?";
FString NaioliQuestion1_1 = "Where are we going?";
FString NaioliQuestion2_0 = "How long have you been here?";
FString NaioliQuestion2_1 = "What is outside?";
};

View File

@ -8,10 +8,6 @@
ASevenStarsGameMode::ASevenStarsGameMode()
: Super()
{
// set default pawn class to our Blueprinted character
static ConstructorHelpers::FClassFinder<APawn> PlayerPawnClassFinder(TEXT("/Game/FirstPersonCPP/Blueprints/FirstPersonCharacter"));
DefaultPawnClass = PlayerPawnClassFinder.Class;
// use our custom HUD class
HUDClass = ASevenStarsHUD::StaticClass();
}