I found something in the forum that helped me create a time for a gameplay mechanic im working on. It works perfectly if I stay in the scene, but if I leave the scene it resets.
The example i've used is I talk to a character. Then 10 seconds later, they decide they are bored, get up and leave the room.
The below combination works perfectly for this:

This is the action (timer) that launches during the conversation.

And this is the timer that runs in the background.
Is there a way for this timer to be run globally? It works absolutely perfectly if I stay on the same scene.
For example, if you make somebody a hot coffee, but take too long delivering it, it turns cold and the character will reject it.
Comments
I have expanded them and i'll explain them.
PART 1
NPC gives you a task
Launches an action list from an asset file.
Passing basic variables:
int (10) - wait 10 seconds
str (Izzy) - global variable name
obj (Izzy) - NPC
obj (to Hallway) - Marker for walk to.
Str (DiningRoom) - Current scene.
Camera returns to normal gameplay and you now wander off to perform your quest.
PART 2:
This waits 10 seconds (as per the varable above)
It then sets a Global variable (Izzy) to 2. This variable indicates that the timer has completed and this character has left the room.
I then perform a Scene:Check, to see if the current Scene matches the scene specified (DiningRoom). If it does, it then goes on to animate the character leaving the room. If you are in a different room, there is nothing to do, so no animation or deleting the character. The global variable has already been set to 2.
If I stay in the DiningRoom scene, maybe just wander around the room a little (confirming gameplay is still running), after 10 seconds the character stands up and leaves the room.
Perfect.
However, if I have the conversation (starting the 10 second timer) then leave the scene (ie visit the Kitchen) and wait 10 seconds... upon returning to the DiningRoom scene, the global variable is still set to 1, and the character is still sitting at the table.
This tells me that the Action List is only running within the Scene and is just being stopped / reset when a new scene loads.
If it helps, when the DiningRoom scene starts, one of the checks is to see if Global Var "Izzy" is set to 1. If it is, it places her at the table.
Any other number, and she'll be deleted from the scene at start. (this works as she doesn't appear there until you wake her up - changing variable from 0 to 1).
I hope I have explained it a bit better?
Any more questions please don't hesitate to ask.
Regards
Kev
For instance, I have a child who starts off asleep in bed.
You have to perform an action to wake them up and send them downstairs for breakfast.
When you enter the DiningRoom they are sitting at the table.
You talk to them to discover what they want for breakfast, and then you have a 2 minute timer to be able to find all the relevant items, prepare their breakfast and deliver it to them.
If you don't deliver it within the 2 minutes, they get bored and wander back to their bedroom to start playing their games console.
You then have to go back to their bedroom, ask them to come downstairs again...
But by this time, if you've made them a cup of tea and some toast, its gone cold.
So they confirm what they want again, 2 minute timer restarts, you attempt to give them the breakfast and they say "ewww! its cold". So you have to make it again... all the time their attention span (timer) is waning....
I'd like the whole game to revolve around mechanics like this.
So 5 different kids. All wanting different things at different times, and each thing you try to make could also have an expiry.
This could turn into dozens of timers running concurrently - but if they can only be checked per scene, I'd have to duplicate ALL the timers in all the scenes, all referencing the same timer Global variable and performing 10 times as many actions as really needed.
If the timers and associated action scripts ran independently from the scenes, i'd only need to setup each timer/action-list once.
Kev
}
@zebbi you may also find this useful. You can restrict this to only the Action Lists you want it to affect.
I've added a layer of safety to stop it breaking AC. If you add a parameter named "Persistent", it'll remain persistent. Without the parameter, it treats it as a normal action list.
RuntimeActionList.cs:
I'm happy to figure out the code if somebody can point me in the right direction?
Video demonstrates - I expected to see three "BreakfastTimer" running.....
I can create an asset file for each, but had tried to make it generic so a timer asset could be used multiple times for different purposes.
Kev