Forum rules - please read before posting.

Creating a diary system like the ones in Uncharted/ NiTW

edited October 2018 in Technical Q&A
Continuing on from the questions in this thread:

I'm looking to create a double-page diary that is updated with information as the player goes through the game. My plan is to create a texture on Photoshop for each page (including text) New pages picked up during the game should be added in and be readable later as well.

These pages might not be picked up in the same order every time, as that would depend on which NPC the player decides to talk to first, the order of objects observed etc. 

So, talking to NPC A would cause an "entry added" to occur, adding page texture 1 to the first page. Then talking to NPC F would add page texture - say - X to page 12, for instance.

Here's some examples from Uncharted and Night in the Woods respectively:

I also intend to have "tabs" for other things like map, options, locations info etc. I've made it work so far by adding a button that launches a different document for each tab, and will be following the solution given in the link above.

As you said, the script that you provided for a single page version will have to be adapted for two pages. So:

1. How does that method work for two pages?
2. How can new pages be added through action lists - at the right spot? (add page texture X to page 12)




  • Sorry this isn't helpful, but just wanted to say I love the artwork and idea :)
  • @KevRev Haha thanks, but the art's from Uncharted and NiTW, not anything I'm working on :)
  • Lol doh!
  • For the dynamic adding of pages, you want to rely on Journals - not Documents.

    Documents are fixed in their pages, whereas Journals can have more pages added to at runtime in the order of your choosing.

    The default pages of a Journal are defined with the Menu Manager, by creating a Journal element.  The Menu: Change state Action can then be used to add pages at runtime.

    I will look into adapting the custom script to work for two-page journals, but in the meantime I'd recommend you have a test of Journals using just text to get a feel for them.
  • edited October 2018
    True, I'd been trying to make it work with journals before realizing there was a newly added Documents feature in AC. At the time I found journals to be a bit limited and saw that switching to documents solved a lot of those problems - mainly the ability to add images.

    I've now added and tested a double page journal using only text and it works - without images as of now.

    -I'm guessing it is also possible to have multiple journals so that I can do the "tabs" method for options, map etc as described above? I was able to make this work with multiple documents. (I'll test this out now and leave an update here soon)-
    Edit: The tabs method works as expected by using a button to launch an action list to do Menu> Change State> Turn on Menu > "Journal map" which uses the same UI as before. 

    Waiting on your response about the updated script/ ability to add images. Thanks :)

  • Discovered another issue that occurs only after I use Menu-> change state to add pages. I've got the preset pages turning working fine otherwise for a double page book with the correct offset.
    Example: If this is a 5 page book and I insert a page at page 2 (index 1) making a total of 6 pages, with [left page|right page], then:
    [1|inserted] ->[3|4] -> [5|6] -> [6|blank] then turning back from this page:
    [5|4] -> [inserted|3] -> [1|inserted]

    As you can see, repetition of page 6 at the end and the change of position and repetition of the newly inserted page shouldn't be happening. Any ideas?
  • I'll attempt a recreation.  Have you used the "Gather text" feature in the Speech Manager to list the pages in your game's text list?  That's necessary for getting the addition of journal pages to work properly.

    It's also necessary for this script to work - since it relies on matching textures with Page ID numbers:

    Once gathered into the Speech Manager, your pages in the Menu Manager will have ID values that you can use to pair up with textures.
  • edited October 2018
    Just did "Gather all text" and tried again - no difference regarding the repeating pages issue.

    Checking the .csv files, it doesn't seem to consist of any of the journal text from the menu or the action list. Anything specific I should select while doing gather text?

    I've attached the script to an empty game object as described in the previous script's method, and it shows up correctly. Now I just need to know the ID from the csv file as mentioned above to attach to the page textures (once I figure out how to make it show up)

    Edit: I "reset text" in order to try again, and now "gather text" gathers 0 lines - the csv is empty. All scenes have been added to the build settings. AC version is 1.65/ latest. This seems to be a completely different issue :/
    It's also giving an error- ArgumentOutOfRangeException: Argument is out of Range
    Parameter name : Index 
  • Please give the full error message as it appears when selecting it in the Console window.

    You shouldn't have to open the CSV file to see the ID numbers - they'll appear in the Action/Menu Manager once set.
  • Yeah, they didn't appear in the Menu manager either (probably because it failed to gather the text)

    Here's the full error - 

    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[AC.JournalPage].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    AC.Document.CanTranslate (Int32 index) (at Assets/AdventureCreator/Scripts/Documents/Document.cs:402)
    AC.SpeechManager.ExtractTranslatable (ITranslatable translatable, Boolean onlySeekNew, Boolean isInScene, Boolean isMonoBehaviour, System.String comment, Int32 tagID, System.String actionListName) (at Assets/AdventureCreator/Scripts/Managers/SpeechManager.cs:1305)
    AC.SpeechManager.GetLinesFromInventory (Boolean onlySeekNew) (at Assets/AdventureCreator/Scripts/Managers/SpeechManager.cs:1518)
    AC.SpeechManager.PopulateList (Boolean currentSceneOnly) (at Assets/AdventureCreator/Scripts/Managers/SpeechManager.cs:1231)
    AC.SpeechManager.ShowGUI () (at Assets/AdventureCreator/Scripts/Managers/SpeechManager.cs:397)
    AC.AdventureCreator.OnGUI () (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:270)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:285)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:278)
    UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:245)
  • edited October 2018
    Thank you - this'll be an issue related to Documents.  I'll fix it for v1.65.1, but it should also go away if you removed any Documents you have (assuming you have no need for them now).

    I still can't recreate the page-flipping issue, however.  When shifting left/right, what's your "Offset amount" property set to, and what are your exact AC/Unity versions?
  • edited October 2018
    The page offset for the "Display existing journal" Journal element is 1. The offset amount for shift page next/previous or turn page left/right buttons is 2. 

    My AC version is the latest (1.65) and Unity is 2017.2.0f3

    Alright, I'll remove the documents and give it a shot. Edit: Removing the documents allowed the gather text to work correctly.

    Here's a video showing my current settings and the page repetition issue. I haven't got around to linking the images with the new script yet so that doesn't work yet.
    The console shows some other unrelated errors that I'll be getting to later.

  • When you reach the end of the journal, you try to shift right by 2 - but there's only one page left, so it shifts by the maximum amount it can, which is 1.  The same happens again when you shift back, once this has occured going forwards.

    This is not a bug, but I agree that there should be an option to only shift if the number of pages to shift by are available.
  • Ah alright, that makes sense. Any possible workaround?
  • You probably want a bit of code on the page shift to add a blank journal page if there's only one page left... Not sure what you'd use to remove it though?
  • This script will snap the open journal page to multiples of two:

  • Perfect!! That fixed it. I'll now get to implementing the textures and let you know how that goes. :)

  • edited October 2018
    The textures are working great for both pages as well!

    Final issue, which I think should have a simple solution that I'm missing - On pages where there's no texture, the placeholder white texture is seen instead. I reduced the alpha in the image's color, but that obviously made the texture disappear as well.

    Edit: Found a workaround - created a blank texture and set it accordingly.

    Alright, ran into a new issue - The textures still have that page repetition problem. I'm guessing the snap page script would have to be updated to account for textures as well? I'm not really sure what to change there though.

  • Not on my end - and with all the issues we've covered in this thread I'm going to need you to elaborate.  Please share some screenshots of what's going on.
  • Here are the images:

    This is probably because I added a page (the second one with id 144) through an action list?
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.