I'm trying do design a hint system that would show a hint button after some while of last objective completion and would also want to include them into translation system.
I think I should create a script with OnObjectiveUpdate hook and check the new state and then show a short message on the screen. But I would like to have some sort of a list in a document or something like csv and then change the text inside the menu. But how could I add this text to AC's translation system?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Could a hint be somehow be tied to objective?
See the Manual's "Custom translatables" chapter. To gather custom text, you need to create a script (could be a Mono in the scene or attached to a prefab) that implements ITranslatable. To work with a CSV, your script would have to reference that CSV and extract its contents manually.
An Objective state has both a Name and a Description. If you're not making use of the Description text, you could store your Hint text in there and get it back inside the event:
Would a local variable be feasible in this? I'm afraid that having a large set of variables in editor is not so usable.
Maybe a objective description has a local variable name and the variable is translatable?
You could feasibly use a local String variable, and then use the [localvar:X] token elsewhere to display its value, provided that you only did so in a scene that had this variable defined.
If you have many variables, local or global, be aware that you can use slashes in their name to organise them in popups, e.g.:
I already made a partly working prototype with Objective descriptions and a global variable hooked to the script. I have the Objectives organized with Scenename/ShortObjective structure ( where these short objectives are just start/complete ). Script reads the active Objectives in that scene when Tips-button is pressed and then just randomly select one. So no need to monitor Objective states.
What I now have is an invisible NPC cube Hint, which speaks the hint. It is a working solution, but I would have wanted to have a label presented in the middle of the screen with different font and size.
I tried to use a disabled input label, but for some reason I didn't get it to receive input. Could I create a different speech menu that would take only Hint cube speech without tweaking AC? Or would this input field approach be reasonable?
Another question is where to put the counter to count down to couple of mins before showing Tips-button. Would it be better to have it in script or AL? I would like to counter to pause when gameplay pauses. Would a script with Update check on statehandler's gamestate do?
Eventually I did the counter inside the script and it has start and stop functions, but the speech menu issue still remains. I have turned the talker colors on, so hints are a bit different in any case.
Elements of type "Input" are intended for player input - e.g. letting them type in their name, or a password. They're not appropriate for inserting custom text via script.
A label element can accept variable tokens e.g. [var:2], which will be replaced by the variable's value at runtime. One approach would be to set a string variable to the intended hint text, and then turn on the menu manually.
To rely on speech, you can set your Subtitle menu's For speakers of type property to limit its display to characters with a certain name. You could create an alternative "Hint" Subtitles menu display to just this NPC, and the exclude that NPC from showing in the original Subtitles menu.
If you have no narration text elsewhere, you can also achieve this by making your hint speech narration - avoiding a need to rely on a dedicated NPC. Any speech without a speaking character assigned is considered narration.
I went for the narrator option - I probably use the same menu item with something else too.
There was a strange thing happening with the label version. I have a hint string variable tied to a script, it works fine with dialogue option [var:x] and AL variable check, but if I try the label version the function that returns a random hint starts firing constantly until I close the menu.
I should start the hint counter after save game load. Is there any place to put an AL, or must I do a script?
The SavesList menu element has an "ActionList after loading" field that you can assign to have an ActionList run once loading is complete.
Alternatively, you can hook into the OnFinishLoading custom event: