Unreal Engine Dialogues and Time

DarkLiezer

New Member
Dec 15, 2021
2
1
Hi, I have literally everything to make a game in ue4 I just need a tiny little thing and that is the dialogues.
I can't get the dialogues to change with the time of the game.
For example I want an npc to say "good morning" when it is daytime and when it is night time that same npc says "good night".

Is there any way to do this or not?

The other option I can think of is to replace the npc that says "good morning" when it is night time with one that says "good night".
But I don't know how to do that either.
 

Saki_Sliz

Well-Known Member
May 3, 2018
1,403
1,011
It depends, how is your system implemented?

from the sound of it, you are a beginner dev, so I'm assuming the assets and tools you are using are those you've gotten, not those you've made.

for example, how do players know what time is it, is it just the color of the screen, the change in lighting, a clock on the side of the screen. you say UE4, so are you controlling a sun light source? Are you using an asset that manages the sky for you? They way you make it sound, it sounds like you already have a way for changing and controlling the day/nigth, and you just need to link that system to your characters.

knowing if you made the system or if you are using an asset can help, or if you are just directly changing the light through code (i'm just using the light as an example).

typically, what you want to do is have a controller. this controller receives commands to set the sky to be day or night, the controller then basically runs the code that does this (maybe it just repeats the command, but passes it to the asset you've been using). the point of the controller is that its a place for you to place your own code, so that it can record things like, the state of the sky. by being your controller, you can customize it, such as, it has a command that returns true or fall if it is daytime or not, and then all your NPC's just ask in code if( timeController.isDaytime() ) {runGoodMorningCode(); } else{runGoToBedCode();}

depending on what you are working with, if it isn't to much of a cluster fuck, I'll be happy to toss some code your way.
 
Last edited: