Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

clock (time) based game

I have just a quick question.

I want to build an adventure based on time, like CRYO's KGB and other examples (ex: at 8:30am (ingame) there are some different conversations or hotspots/characters visibles than at 10:00am).

After doing (little but some) research in your plugin.... this is doable with your menu and actionlists systems? 

I usually just use Ngui and Playmaker to all the variable thingys (Make the logic and show it), and I can doit again (just active/deactive items based on playmakers variables, and show the time with a ngui label connected to playmaker, but I was likely to try to make the whole game just with the Adventure Creator (that is a GREAT engine, by the way). I was making some menus and I'm not sure if the Adventure Creator Menu system can keep a hour/minute system and show it. I guess I can not use ngui an just show the variables of time with Unity GUI but...  Adventure Creator is capable of listening correctly to a hour/minute variable?

I know that I'm making a question that I can resolve using playmaker and ngui, but I just want to know If I can use only Adventure creator, or playmaker plus adventure creator, Instead of the three plugins. 



  • Best to store the hour and minute as separate integer Global Variables, in the Variables Manager.  They'll then be stored within save games automatically.

    To change their values in-game, you can either write a custom script (see this page) or build an ActionList asset that runs in the background.  Using a combination of Variable: Check and Variable: Set Actions, set to loop back on themselves every few seconds, you could probably get it working quite well.  You'd have to set the ActionLists's When running property to Run In Background, so that it doesn't interfere with gameplay.

    Once your variables are being correctly set, you can then use tokens to place them in a menu label.  In a variable's entry in the Variables Manager, you can see it's token string, which - if placed within a Label's textbox - will be replaced with the variable's actual value in-game.  So something like:

    The time is [var:2]:[var:3]am.

    You could also have another variable for am/pm, thinking about it.
  • Thanks! Very fast approach. I really like the idea of making the game only with the AC engine (in gameplay) so I keep all things together, and for saving mechanics... 

    I found a little problem anyway... In playmaker/ngui I force the time to show always, for example, in two digits. (When converting the int to a string format). (if the variable hour is 8, and minute 5, See the time like "It's 8:5" It's really bad, when It will have to say, 08:05". One way to fix it straight is making 4 variables (first and second digit), but that increases scripting complexity (using an Actionlist running in background, I'm not a great programmer)
  • Indeed, that does complicate things quite a bit.  I would say that's then a reason to do it by custom scripting instead.  Ask on the Unity forums for help on general scripting.

    Once you have a script that sets the values of it's own set of variables, you can transfer their values onto the AC counterparts very easily.  The front page of the scripting guide gives an example.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!