» Mon Jun 18, 2012 8:37 am
If you want to do anything beyond creating map layouts and altering stats on items, then yes, you will want to learn this. And the sooner you start, the better.
But don't start with somethng big. I first exposed myself to scripting back with Morrowind. At the verry beginning of the game, there is a character who leaves town if you help him out by loaning him some money. He is never seen again in the game after that. His house remains locked. You can break in and steal junk that is inside, but that's it. I got this idea that the player might buy the house. This presented an interresting issue. The house would need to exist in three states, Owned by the NPC (before he leaves town), Owned by Arille (the general store owner who holds the key after the NPC leaves town), and Owned by Player (after it is bought). First thing I did needed no editing. I loaded up the interior, Duplicated it and placed it in the same cell off to the side of the original version. I took out all the items that the player might pick up, but left all furniture intact, including the bed. But I changed the ownership of the bed to Arille and made the containers safe to drop stuff in. I wanted to make sure that if the player slept in the bed, he'd get fined for tresspassing. Next, I duplicated this interior and changed the bed ownership to Player.
So I had three instances of the same interior. Now the delimma became how to control when the player could access each of them. The key was in extending the quest that involved helping the NPC out so he could leave. So I added two additional steps to the quest. One for his house being for sale, and the other (the new end of the quest) being for when the player had bought the house. So here is where the scripting came in. I had 3 interiors. So I needed 3 Doors. Each Door was given a script that controlled when they were enabled or disabled. The first Door was scripted to disable based on the same conditions in the script that removed the NPC from the town (when the player left the cell the NPC was in, he would be disabled). That was important because otherwise, it would disable the moment you give the NPC the money he needs to afford to leave town. The second door, disabled by default was set to become enabled on the same conditions. It was also set to disable itself again when the house was purchased. The third Door, also disabled by default, was scripted to become enabled when the player bought the house, using the quest status as the condition. All 3 of these doors were placed in the exact same spot, so regardless of which stage the quest was in, there was no visible indication that anything was different.
Buying the house was handled through Dialogue with Arille. Conditions were set to make sure that the option would not appear until the NPC left town. I had some other quests going on in the town that paid some money. I made sure that the cost of the house was exactly the amount you could directly earn through those quests. Script segments were needed in the dialogue as well to make this work.
It took some trial and error to do all this. In the end, things worked out exactly as I needed them to. How did I learn? Because I wanted the whole thing to be centered around when the NPC left town, I studied the scripts, Dialogue and Quest data associated with him. I paid attention to how the developers set things up and experimented with those methods and found what ultimately worked. Did it take time? Absolutely. Could I have just asked the community how to do it? Of course. I did have to ask for a few pointers because the scripts were not working correctly, and it turned out I had made some mistakes. Once I knew what I did wrong, I figured out how to do it right. I wanted to learn. It felt great solving the problems with the only help being in the form of advice or pointing out a mistake I made.
But to be honest, I am right with you. I don't know a thing about Papyrus. But I will be learning it the same way.