User Tools

Site Tools


building:journal

Using the Journal

Using the Journal Editor

This is not recommended and not an option on Sinfar's main servers.

But if you are a server admin and really want to:

  1. Create / Modify your module journal:
  2. Upload it in your top haks section of your server's config page:
  3. Use the default scripting functions:
    AddJournalQuestEntry("Category000", 1, oPC)

It will work but it is bad:

  • The module's journal can get very big (you can only have one)
  • Changing the module's journal can break existing quests / entries
  • It is not persistent (The entries will get cleared on a server reset)

Standalone Scripting Functions

Sinfar has scripting functions that let you add and remove entries from a player character's journal, without having to use the journal editor:

void JournalAddQuest(object oPlayer, string sPlotId, string sTitle, string sText, int nState, int nPriority, int bCompleted, int nCalendarDay, int nTimeOfDay);
void JournalRemoveQuest(object oPlayer, string sPlotId);
void NotifyJournalUpdated(object oPlayer, string sMesssage, int bIsQuest=TRUE, int bIsCompleted=FALSE);

There's also an event: 0_init_journal … that gets called when a PC journal should be initialized.

It is good if you want to get your hands dirty but you will have to handle manually the following:

  • The persistence (the entries will be cleared when the PC logs out)
  • Getting the current entries (There's no functions to get the currently added entries / quests)

Sinfar's Persistent Journal System

This system provide higher levels functions so that the added quests be persistent and you can query them. It is in this ERF: https://nwn.sinfar.net/res_list.php?erf_id=847

All functions are in this include script: https://nwn.sinfar.net/res_nss_edit.php?name=jrl_include

For example:

#include "jrl_include"

void main()
{
    object oPC = OBJECT_SELF;
    struct JournalEntry jrlEntry = JRL_GetQuest(oPC, "TEST_QUEST001");
    if (jrlEntry.nState > 10)
    {
        JRL_RemoveQuest(oPC, "TEST_QUEST001");
    }
    else
    {
        if (jrlEntry.sTitle == "") //oPC is not yet doing this quest
        {
            NotifyJournalUpdated(oPC, "TEST_QUEST001 has been added to your journal!!");
            jrlEntry.sTitle = "Quest 001";
            jrlEntry.sText = "Quest Started";
        }
        else
        {
            
            if (jrlEntry.nState > 5)
            {
                jrlEntry.sTitle = "Quest 001 - Completed";
                jrlEntry.sText = "Quest Completed!!!";
                jrlEntry.bCompleted = TRUE;
            }
            else
            {
                jrlEntry.sText = "Quest In Progress";
            }
            jrlEntry.nState++;
        }
        JRL_AddOrUpdateQuest(oPC, jrlEntry);
    }
}
building/journal.txt · Last modified: 2019/08/21 04:10 by Mavrixio

phpBB Appliance - Powered by TurnKey Linux