Now that you have understood how Conditions and Outcomes worked as "gates" in game, let's try to create some scripts, which served as the "brain" of these gates (think of them as the gatekeepers).
NWN2 is a conversation-based game (as opposed to shoot 'em ups), this means, most of the storyline and NPC responses were conversation driven. Hence, all the conditional checkpoints must be placed inside a conversation thread in order to work.
Contents |
Way back when it was still NWN1 (2002-2006), many modders complained about how hard it was to learn to script, because most of the early tutorials were created by computer science students, and they smelled like computer science lecture notes! Because many modders were non-programmers, they find it extremely frustrating to have to learn "C" before they can script. Wasn't the toolset's purpose to allow non-developers and non-programmers to create stories? The need to learn scripts as a programming language was so counter-productive!
Thankfully, some kind soul (actually, his moniker is LilacSoul) decided to help the non-programmers out and created a Script Generator to make script writing a much easier task. Without Script Generator, NWN/NWN2 modding probably would never be as popular as it is today! In fact, the Script Generator was so useful, that many non-programmers actually learned to write simple programs by just observing how the finished scripts were written. But that's another story.
Now, do yourself a great favor, and download LilacSoul's Script Generator (version 2.3) using the following links: Script Generator's Page at NWVault at IGN.com | Zipped file of Script Generator | Manual of Script Generator.
Once you have downloaded the zipped file, unzip it (using 7-zip) into a directory of your choice. The zipped file will yield 4 files, as shown below.
The Script Generator does not need to be installed, it runs AS IS (and works with Windows 7 also). To use the program, double click on it and it should start. You may want to create a shortcut to the program and drag it onto your Desktop or Start Bar for easy access.
[I will leave you to read the Manual of Script Generator yourself. Besides, there is really no need to duplicate LilacSoul's effort by creating yet another tutorial to teach you how to use the Script Generator!]
Using the scenario given above, speaking to Frans before speaking to Bennay is one condition player must fulfill. To do this,
Actually, all that is required are the following section:
void main ()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "spoken2Frans", 1);
}
Do you think you can decipher what is going on in these 5 lines of code? You should have met voidmain() { } in the last tutorial. So let's examine the command inside the angle brackets ({ }) for a moment. Whatever falls within these two brackets are the actual commands (or computations/instructions) to be carried out by the program/game.
1. Declare a variable (like x in Algebra), in this case oPC, which stands for "object Player Character". (Note the convention used here, small letter for the first word, and CAPS for the following words). Set the variable oPC to the value of GetPCSpeaker(). The function GetPCSpeaker will identify which avatar is the Player Character, and then assign a variable oPC to it.
object oPC = GetPCSpeaker();
2. Terminate the instruction by semicolon (;). The semicolon is very important, you must terminate each line of command with a semicolon!
3. The following line creates a Local Integer: spoken2Frans, and assign the value 1 to it. It then attached (glued) this variable to oPC (the Player Character).
SetLocalInt(oPC, "spoken2Frans", 1);
Summary:
Basically, we have performed the following tasks:
Now that the variable is in the PC's INVENTORY, Bennay will "see" it, and tell the player about the Basement quest. (See next tutorial for instructions on how to do this).
Continue to ยป spoken2Frans | Return to Basic Skills