Automatic note book

From The DarkMod Wiki
Jump to: navigation, search

Introduction

If you are planning to create a mission, in which the player receives a lot of notes containing a lot of information, you always have to ask yourself if this will please everyone. Not everyone likes to take down notes while playing, so it would be good to have a note book that does this automatically. This is standard in most RPG's and adventure-styled games, and here it is described how you can set it up.

The scriptobject

The first thing you need is the appropiate scriptobject. It can be found here. Copy it in your script folder, remove the txt ending and include it by adding the line

 #include "script/tdm_diary.script"

in the tdm_custom_scripts.script file. If no such file exists, you have to create it.

The note book

In DarkRadiant, create a book entity. You should use a mobile one. Add the following spawnargs:

- "scriptobject" "flexible_readable": Let's the book use the appropiate scriptobject - "gui_page1" "name_of_your_gui_here": The gui the book should use. Note that currently only one-sided guis are supported - "num_pages" "1" - "lineNums" "0" - "max_lines" "X" : The maximum number of lines that fits on one page depending on the gui you've choosen (you can test this in the readable editor)

That's it for the note book.

Adding notes

Now you have the notebook, but it's empty. If you want to add a note, follow these steps.

Create a gui_message entity. You can find this under targets. Add the following spawnargs on it:

- "scriptobject" "tdm_diary" - "call" "addMessage" - "diary" "name_of_your_note_book": fill in the name of the above created book entity - "text" "your_text_here": the text that should be added to the note book - "lines" "Y": the number of lines required for the text

The message will be added to the diary when the entity get's triggered.

Properties

Every message will start on a new line. If you want to have line spaces between the single messages, set the lines spawnarg to a higher value then really required by the text. If the number of lines left on a page are not enough to contain the message, a new page will be automatically created to show the message.

--Obsttorte (talk) 12:17, 19 March 2013 (EDT)