Dispatches From Neverwinter

A journal of my progress as I (attempt to) learn how to build modules for Neverwinter Nights.

Name:
Location: United States

Started playing Neverwinter Nights back in November '05 and got hooked. Tried to write my own module, but I just didn't have the time. Maybe I'll try again someday.

Saturday, August 19, 2006

New Things Learned; Problems Still Unsolved

Got in about six hours straight working on the module today. In terms of getting it done I actually made very little progress, but in terms of learning it was very productive.

The big thing today was working on getting the non-combatant peasants to not fight back and also on getting them to walk away and disappear on cue. I had more success with the latter than the former. First I had to figure out how to make something happening in one NPC's conversation affect all the others. The first part of the solution was realizing that it's easy to call a variable from any object. I'm not sure why this didn't click to begin with, since it's pretty obvious. The second part was discovering that you use the AssignCommand function when you want a script on one object to make another object do something. In this case, I set a variable on the PC during a conversation with an NPC. At the end of that conversation, I used a bunch of AssignCommands to make the other NPCs walk away. If the PC tries to talk to them, the variable tells them to say one line and keep walking, rather than stopping. It took a while to iron all the bugs out though, and I got a very good lesson in the importance of making sure that a tag in a script exactly matches the tag on the object I'm calling, and that just because you think you spelled it right, it doesn't mean you did. Also, although I got everything to work the way I wanted it to, I wasn't exactly able to get it to work how I wanted it to. For some reason I couldn't get DestroyObject to work with AssignCommand. I solved the problem by doing things the way I originally intended, i.e., by having a trigger destroy the NPCs when they walked over it, but I'm left wondering why it didn't work.

Getting the non-combantants to be non-combatants was a stickier problem. I went into the OC and found a peasant who cowers and calls for help when attacked and exported her to my module. It turns out she had no scripts in her event slots except for one in the OnAttackedEvent. So after tinkering with it for a bit, I tried it out. It worked in the sense that the peasants didn't fight back. Unfortunately, they don't do anything else either unless directly attacked, and even when that happens, only the one being attacked will respond. What's more, the goblins pretty much ignore them and only attack the NPCs with weapons. The rest just stand around. I tried to fix this by calling the script in the OnPercieved event, but all that did was fire the script once at the beginning (and since they all act in unison, it looks more like a group prayer session). So I read up on loops and tried to put on in that would make the animation fire repeatedly until all the goblins were dead, but I didn't do it correctly, and so it caused a lot of errors. Ironically, I accidentally put the OnPhysicallyAttacked script in the OnPercieved event for one of the peasants, and it did create the kind of loop I wanted - except that it didn't stop firing after the battle was over.

I also went through my scripts, deleted ones I wasn't using, backed up ones I was using, and then ended up making more that I ended up not needing. I also did a lot with conversations; specifically, setting and calling variables and having scripts fire in them. I'm looking forward to getting past this area, as I don't think there's any unusual or complex scripting coming up for a while.

Oh, and script to set the camera mode in the trigger doesn't work after all.

0 Comments:

Post a Comment

<< Home