Hello, I have a day-night system, but when it’s night, the character goes to sleep. For example, when I press the ‘E’ key, I want to speed up time. How can I increase the speed when pressing the ‘E’ key, referencing from the map blueprint?
Is there a function like “Cast to” where I can retrieve the speed and increase it?
-
Communicating with the LB can be a royal pain in the neck - but this is a sign the script is in the wrong place as you should never need to do it. The night / day cycle script does not belong in the LB. Either create a manager actor or script it one of the framework classes - the
Game Mode
could be an OK place, and is easily accessible from anywhere, anytime. -
If you absolutely must have the script in the LB (what happens when you go to lvl 2, though - you will need to script the whole thing again!), is to leverage an
Event Dispatcher
. Have the LB reach out to the actor who controls the cycle (thePlayer Controller
presumably), and register an event. At least this way you get to keep controls where they belong. -
alternatively, you can place E input directly in the LB, but then you’d need to deal with input consumption and priority
@ClockworkOcean Here’s some arcane trickery someone will surely misuse:
Implement an interface in the level (script actor). It can return data, ofc. I believe this has been possible since the introduction of:
Yikes this is better than tick!
Thank you very much, I will try to change it, it was a good idea
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.