Help with the Journal

Post » Sat Dec 12, 2009 10:43 am

I'm currently writing a quest in the Construction Set, but I've no idea how to make the journal update itself. Currently I have the quest's dialogue and journal entries written, with the text appearing in the assigned order based off the journal entry's index number. However, I don't know how to prompt the quest to start, ("Your Journal has been updated") then update as required.

The quest is offered by an NPC, with a yes/no choice. How can I assign the first journal entry to appear upon answering 'yes'?

I presume it's using scripts, going off the example http://www.themcnews.com/Script.htm, but I don't know how I'd phrase it.
User avatar
Connor Wing
 
Posts: 3465
Joined: Wed Jun 20, 2007 1:22 am

Post » Fri Dec 11, 2009 8:12 pm

What you require is technically script code, but it is run from dialog results. At the bottom of the dialog window you will find 'Result'. It is in this blank region for any dialog entry that you include the 'code' that will update the player's journal, modify disposition, add or remove items - just about anything you would otherwise perform with a script.

The code you want is: Journal "Journal Name" index. Where Journal Name is the name of the journal entry (not the name of the quest) and index is the numerical value you assigned to a given journal entry. You can find examples throughout the official dialog entries by checking quest topics. For example look at Bacola Closcius' top entry under the topic 'Caius Cosades' you will read in dialog results Journal, "A1_1_FindSpymaster", 10 (the comma is optional).
User avatar
LittleMiss
 
Posts: 3412
Joined: Wed Nov 29, 2006 6:22 am

Post » Sat Dec 12, 2009 5:45 am

Thank you so much! The tutorial I was using seemed to have forgotten to add that part. If it isn't too bold, I'd like to pick your brains a second time though... :P

I'm looking to have the player pick up both a custom bottle of Skooma and note that I've added to a chest before the journal will update again. Going off what the tutorial did include, I copied the script that was provided, in this case making:
begin Banolzskooma

short done

if ( done == 1 )
return
endif

if ( onactivate == 1 )


Journal SN_BanolzSkooma, 30
set done to 1
activate

end

Now, if I added this to both items, I'm presuming there would be two duplicate journal entries, and picking up one or the other would prompt an entry. Do you know how I could have both picked up before the next journal entry is reached?
User avatar
Amysaurusrex
 
Posts: 3432
Joined: Wed Aug 09, 2006 2:45 pm

Post » Fri Dec 11, 2009 11:15 pm

Before you get too deep into your first project, you might consider a naming convention for all of the elements that you add to a mod. It will make finding things and troubleshooting easier for you. For instance 'Banolzskooma' is not a convenient name unless your name or the mod's name is Banol(z).

For instance, my convention is cyr followed by two letters indicating the mod. E.g., Traveling Merchants is cyr_tm. That is the prefix for all objects (and scripts) in the mod (or will be when version 3.0 is complete). Your journal has the prefix SN_ likely representing your name or the mod's name. If that is an appropriate prefix for the entire mod you would do well to use it on all objects including the custom skooma.

But back to the matter at hand... It is easy to prevent the repeated journal entry by performing a journal check first. This is in itself makes the journal update do-once eliminating the need for the done flag. This is what your script might look like:

Begin Banolzskoomaif ( OnActivate == 1 )    if ( ( GetJournalIndex "SN_BanolzSkooma" ) < 30 )        Journal "SN_BanolzSkooma" 30    endif    Activate  endifEnd Banolzskooma

Bethesda is not very careful about this precaution, and it most (all?) instances that I recall the journal is not really updated a second time. Still it is better that the player does not receive the message that it has been updated.

Depending on your exact circumstances, you can trigger the journal update for a different situation. You have for when it is activated, but that will only trigger if the object is accessed from the world. If the object is in a container (as you describe) you will not get the journal update. In your situation a check for OnPCAdd would be more suitable.

Begin Banolzskoomashort OnPCAdd ; this is a variable not a function so it is declaredif ( OnPCAdd == 1 )    if ( ( GetJournalIndex "SN_BanolzSkooma" ) < 30 )        Journal "SN_BanolzSkooma" 30    endif    ActivateendifEnd Banolzskooma

Your note poses different problems. In most situations you want the journal update as a consequence of the player reading the note and not merely for having it in the player's inventory. A note can be read by activating it if it is place in the world. However if it is in a chest (or added directly to the player's inventory) the note must be equipped in order to be read. If that is what you are trying to achieve this is my preferred 'note' script (slightly modified for your purpose). It works whether the note is read from the world or from inventory:

Begin SN_NoteScriptshort readNoteshort OnPCEquipshort PCSkipEquipif ( readNote == 1 )    returnendifset PCSkipEquip to 0If ( OnActivate == 1 )    if ( ( GetJournalIndex "SN_BanolzSkooma" ) < 30 )        Journal "SN_BanolzSkooma" 30    endif    set readNote to 1    Activate    returnendifif ( menumode == 0 )    returnendifset PCSkipEquip to 1If ( OnPCEquip == 1 )    if ( ( GetJournalIndex "SN_BanolzSkooma" ) < 30 )        Journal "SN_BanolzSkooma" 30    endif    set readNote to 1    set OnPCEquip to 0    set PCSkipEquip to 0    ActivateendifEnd SN_NoteScript


Edit: for consistent scripting conventions.
User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Sat Dec 12, 2009 11:35 am

Again, thank you, this really is amazingly helpful! :)

So I take it the second script, the one that would prompt a journal update when the skooma was added to the inventory, would be added as a script to the bottle itself, while the longer 'notescript' would be attached to the note? I'll try that. :) I guess to simplify things I could just put that script I tried to use first on to the chest itself...

Also, for consistency I'll go for SN_DAname (Seyda Neen, Dangerous Addiction).
User avatar
Joey Avelar
 
Posts: 3370
Joined: Sat Aug 11, 2007 11:11 am

Post » Sat Dec 12, 2009 2:40 am

You are correct in your assumptions about where the scripts are attached. It is also true that the OnActivate script could be attached to the chest itself, but depending on the text of the journal entry it might not be appropriate. If it merely chronicles the discovery of a note and bottle of skooma, then it would be fine. However if the journal entry discusses the contents of the note, it would be better to have it added at the moment the player reads the note.

Reading your second post more closely I wonder if you mean for the journal to update after the player has both the note and skooma in his/her possession. It is possible to check for both before adding the journal update if that is what you require. Another approach would be to have two journal entries, one for activating the skooma and a second for reading the note. If any of those alternatives are what you require say so in your next post.

You will be happy to have settled on a naming convention before your mod gets very much larger. Names of things can be changed, but it can be a headache.
User avatar
N3T4
 
Posts: 3428
Joined: Wed Aug 08, 2007 8:36 pm

Post » Sat Dec 12, 2009 7:24 am

Yeah, I intended for the skooma to be in the inventory, and the note to be read before the journal updated. I tested one of the scripts you provided (the second, "short OnPCAdd"), but something seems to have gone wrong. When I picked up the skooma and put it into my inventory, the journal updated just fine, but the amount of skooma sky-rocketed. A couple of seconds later when the game locked up and froze, I had about 8,500 of them. I'm not sure why that happened, seeing as I just copy/pasted the second entry into a new script and attached it to the bottle of Skooma.

EDIT: Tell a lie, the bottle doesn't get as far as my inventory - when I select it / pick it up, my encumbrance goes up to about 8500 before the game locks up.
User avatar
T. tacks Rims
 
Posts: 3447
Joined: Wed Oct 10, 2007 10:35 am

Post » Sat Dec 12, 2009 2:20 am

What you describe can be the result of a script that adds an object (your skooma bottle) that is not flagged to do it once. However none of the scripts I have posted add to the player's inventory or that of the container, or even reference the bottle. I have successfully tested the script you attached to the skooma bottle. Do you have any other scripts running in this situation that adds the skooma to the player's inventory. If I had to guess based on what you describe I would expect something like this:

if ( ( GetJournalIndex "SN_BanolzSkooma" ) == 30 )    player->AddItem "SN_DA_skooma" 1endif

This section of code is triggered by taking the skooma bottle and updating the journal to a value that conditions the adding the item. It would be easy to overlook that a bottle will be added to the player's inventory every frame unless a do-once flag is toggled. I need to know more about what you have already done to track down the cause of the problem, but perhaps I have written enough to help you find it yourself.
User avatar
FABIAN RUIZ
 
Posts: 3495
Joined: Mon Oct 15, 2007 11:13 am


Return to III - Morrowind