PDA

View Full Version : Some Scripting Functions


Gargoyle King
01-23-2008, 08:56 AM
Hi All!
I'm trying to make my first mod for Kotor, all i'll say for now it has an NPC with useful dialogue in Korriban with maybe a small quest. I've started writing my dialogue, but can't get my head around scripting and adding journal entries for a quest. I'm trying to get my NPC to say something, but due to a certain reply by the PC the NPC will say something else the next time you speak to them.

An example:
[merchant] Hi there! are you intersted in buying some goods?
[Yes]
[No]

If you reply no, the dialogue will change permantly next time you speak to the NPC into something like this.

[merchant] Oh! I didn't expect to see you again, ready to buy now?

Just how would i manage to change NPC dialogue paths according to PC reply.

Quest Journals also confuse me. How would i create a quest, attach it to dialogue and change the NPCs dialogue paths according to quest outcome etc? Also what script would i need to make certain NPCs in my quest appear once the quest initiates?

Any help would be greatly appreciated, even pointing me towards useful tuts etc. If i can't complete this mod i can use this experience to learn.

Thanks In Advance!
-GK

CrisG
01-23-2008, 10:11 AM
Gargoyle_King, I am sure many other veterans here can help with detailed knowledge, the lists and general info on all the tools and techniques are here to start with:


Tools

StarWars Knights.com

http://www.starwarsknights.com/tools.php#kse

Guide and Overview of Tools and Links Darth333

http://www.lucasforums.com/showthread.php?s=&threadid=143421

Tutorials on Modding KOTR I and II

http://www.lucasforums.com/forumdisplay.php?s=&forumid=592

Dialogue Editing

Pavlos

http://www.lucasforums.com/showthread.php?t=180845

How To Add Journal Entries

Darth333

http://www.lucasforums.com/showthread.php?t=143372

Properties of a Dialog File

tk102

http://www.lucasforums.com/showthread.php?t=143356

Biowar Aurora Engine Conversation File Format

http://nwn.bioware.com/developers/Bioware_Aurora_Conversation_Format.pdf


Dialogue editing:
Note by Darth333 on latest tools to use:

http://www.lucasforums.com/showthread.php?t=130451
tk102 has ......released a user friendly gui version of the [dialog] editor with lots of additional functions: DLGeditor. Do not use KotOR Tool's dialogue editor if you are editing KotOR 2: TSL *dlg files. KotOR Tool's dialogue editor is not fully compatible with KotOR 2 and you will loose some valuable data.

Gff editor:
Doom_Dealer'S tutorial also suggests to use the now defunct nwneditor instead of the Bioware GFF editor. Should you chose to try the Bioware editor, note that some data in your .gif and .ifo files will be corrupted as some fields are not supported by this editor. Instead of the nwneditor or the Bioware GFF editor, we recommend that you use tk102's K-GFF: it's a GFF editor made especially for KotOR.

KotOR 2 and the whereami cheat
The cheat console in KotOR 2 is invisible. To get the placement coordinates in KotOR 2, you will need the "whereami armband".

The latest versions of DLGeditor, K-GFF and the whereami armband are available on our website: http://www.starwarsknights.com/tools.php

In Depth Dialog Editing
Doom_Dealer

http://www.lucasforums.com/showthread.php?t=130451

Gargoyle King
01-24-2008, 07:18 AM
Thanks for your help CrisG! Much appreciated! :thumbsup:
-GK

stoffe
01-24-2008, 07:28 AM
I'm trying to get my NPC to say something, but due to a certain reply by the PC the NPC will say something else the next time you speak to them.


If there is just one such variation you can use the standard scripts k_act_talktrue and k_con_talkedto for this. The former is an action script that sets a boolean variable on the dialog owner. The latter is a conditional script that checks if the boolean variable is set.

So you'd put k_act_talktrue in the action script field of the dialog node that should trigger the alternate greeting. Then you add another top-level entry node in the dialog tree above the standard greeting one and set k_con_talkedto in its conditional script field.


Quest Journals also confuse me. How would i create a quest, attach it to dialogue and change the NPCs dialogue paths according to quest outcome etc? Also what script would i need to make certain NPCs in my quest appear once the quest initiates?


You add new quest journal entries in the global.jrl file. It's a GFF format file which can be edited with K-GFF. Just copy and paste one of the existing entries and modify it. The tag field is a text string used to identify that particular quest in scripts in DLG files. You set it in the Quest field on a dialog node to set a quest stage. Quest stages have numeric IDs and are the different steps that make up a quest. Each has its own journal text, and when you set a stage the text for that stage will be shown in the quest journal. (You specify what stage to set in the DLG editor in the QuestEntry field.)

You can check what stage a particular quest is on from a script using the GetJournalEntry() function, where you specify the quest's tag as parameter. For example...

int StartingConditional() {
return (GetJournalEntry("TestQuest") > 10);
}

...is a conditional script that makes the dialog node it is attached to available if the quest with the tag TestQuest is at a stage higher than 10.

Gargoyle King
01-24-2008, 09:09 AM
Thanks Stoffe! :)
That's just what I needed to know! :thumbsup:
-GK