Documents

Just like items and weapon Documents are collectable objects that can be stored into the inventory.
Unlike items they cannot be used but only inspected, unlike weapons they cannot be equiped.
 
Just like all the other kind of collectable objects, documents are represented into the scene with a TAG object:
 
But unlike items and weapons there isn't a specific object class to represent the document into the inventory.
Usually an itemObject with a special GameMachine is used.
 
 

Creating a new document
 
Just like items and weapons, to work a document needs a TAG to be placed in the scene and an entity to be store into the inventory.
 
Following are the steps necessary to create a working document for your game:
  • Create a documentTAG using the create objects from scratch procedure.
    The documentTAG is located into the Entities category of the create tool.
  • In the same way create an itemObject. It will be used for creating the document prefab.
  •  In the created itemObject insert the examineDoc.gms gameMachine into the gameMachines parameter. This gameMachine has some parameters that will be explained later.
    The gms is located in the EasyGamePack\Items project folder.
  • Eventually set the icon parameter of the itemObject. It will be used as document icon in the inventory but it is also used by the document GameMachine as background of the document text when examining it.
  • Using the examineDoc gameMachine, documents can have up to five pages. Every page contains a text stored in a textual file. So create 1 or more textual file in which you put the text of the document.
    Textual files can have the extension you want but for simplicity you can give them the extension sc2 (s2script) in order to make s2engine to recognize them as resources and show them into the project browser.
  • Set the page0...page4 parameters of the gameMachine with the file path of the textual file you created. To do this you can insert the path by hand or you can click right mouse button and choose "Choose file..." from the dropdown menu, as showed into the following gif:
  • Set the numPages parameters of the GameMachine basing on how many textual files (pages) you have configured.
  • Set the Title parameter of the GameMachine ad the title you want to give to the document.
  • Now select the itemObject (if you have not already selected it) and create a new prefab using New->Prefab->FromSelection from the dropdown menu, as showed into the following gif:
  • In the documentTAG set the itemObject parameter with the created prefab.
  • Eventually create a prefab with the documentTAG also, so you can fastly reuse it or recofigure it with another document prefab without re-creating it from scratch.