Tuesday, 29 March 2011

A Pleasure Doing Business

I have been continuing to look at and work on creature AI over the last week, and believe I have reached a point where I am able to enable monsters to do a little extra if need be. Some thanks must go to Derek (Chaos Wielder of Shagret), who showed me some examples of overriding AI scripts. For those who are not aware of his work, be sure to check out his site. My thanks also goes to Pain once again, who has continued to help me understand a little more of what is going on behind the scenes. In the course of our chats, he guided me to the Common Script Library, which I have also posted a permanent link to in the left hand pane.

A More Realistic Store

After being inspired by seeing a rework of the store GUI using different textures, I decided to set aside a little time to finish off my own store GUI. Below is the result of combining the two GUIs I had already designed (first seen in this blog post) into a single new one. Personally, I much prefer the colours in the new design, and am pleased that I was able to include all the extra store information into the single GUI without compromising the information given. Furthermore, it has now been made clearer to the player which stock is new or limited in nature by showing it in a light blue font. Check out the image below, which shows two pages of "Gavin's Goods".

As regular readers of this blog will know, my aim with stores was to make them exciting places to visit by adding random elements to them. Now, not only do some stock items change from time to time, but even the cost of having items identified may change sometimes.

Henchman Game Exit Crash Fix

During my course of looking at creature AI I came across a game bug. For those who may not be aware, there is a bug in NWN2 that causes the game to crash when a player has a henchman in their party and they try to leave the game. After discussing the problem with other players, especially Matt Rieder of The Wizard's Apprentice, I set out to fix the problem. At Matt's suggestion, the problem was resolved by adding some code that removes any henchmen before the game exit calls were made. It involved editing the optionsmenu.xml and adding one script, but the end result appears to work well. I even added some code that reattaches the henchmen if the exit is abandoned. I have uploaded the Henchmen Game Crash Fix (LB) to the Vault for those interested in the fix.

Monday, 21 March 2011

Creature AI

It's been three weeks since I last posted and during that time I have been drifting from topic to topic with respect to the module. I have spent some time writing more to the manual, some time giving older scripts a rewrite and lastly, some time investigating monster artificial intelligence (AI) related scripts. Unfortunately, I have to confess that in all this I have not been very productive, as I have been hampered by my health more than usual. I would start to look at something, but poor concentration would prevent me from doing much.

At the start of the month, I looked at scripts by Shaughn relating to oozes. I had reached a stage in my module where I wanted to start working with monsters and this seemed a good place to start. Something I did not expect, however, was to find myself wanting to rework much of the way monsters worked in NWN. The reason: I learned that creature AI in NWN2 is far from straightforward to set up. (Perhaps it's just me.) During my pondering, I ventured into new territory and had the pleasure of learning a little more about the subject from "Pain", who has provided some extensive information at the Neverwinter Citadel Project. (When I see the kind of work people like Pain do, I realise just how slow I am.) He is currently reworking the entire AI system for NWN2 (among other projects he has underway), which I am keeping an eye on for possible future use. In the meanwhile, I have learned enough to know how to tweak monster AI in ways that will be useful for my own modules without having to "reinvent the wheel". One such area I have already covered is monster auras - which may not be the most difficult of AI to work on, but is good to have sorted. As I continue to add the various monsters to the modules, I will look at a creature's individual AI as it comes along.

The Manual

Between trying to get to grips with creature AI, I have also been doing more to the manual. Thankfully, this is a much easier task as I am able to copy and paste much of its content from material I have already written somewhere else in the past. I have had to change the sentence structure and make the odd correction/update to how I finally had a system work, but the main content remains unchanged. If people are interested, I may upload a few more pages in another blog.

Scripts Rewrite

It seems to me that every now and then (normally when I try to add a new aspect to the module, like monsters this time around) that I encounter an area of code that I have not looked at for a while that raises its head in such a way that forces me to look at it again and often rewrite it. For example, while looking at some code that had NPC's react to a PC's actions, I realised I had two scripts that were similar, but had subtle differences according to whether the PC was bashing an item or casting a spell upon it. The problem was, in one, I had "fixed" an aspect that checked for certain conditions of the PC, while in the other, it remained much more generic. The problem had come about because I had obviously recognised an issue when testing one aspect of the game (bashing the object), but not another (casting a spell on the object). The bottom line is, some good has come from this, as it meant I could take the best from both scripts and amalgamate them into one function, which then made the whole thing run more efficiently. It's just annoying that I did not have them like this in the first place!

The Crafting Poll

The poll asking the player's crafting preferences came to an end and here are the results.

I was surprised at the relatively low number of votes compared to traffic reported on the site stats, but am grateful to those that did take the time to vote. I think the only real information I can take from this is that:

  1. The majority of those that voted will craft anyway.
  2. The new system I am working on does look like it will encourage some to try.

Even the one vote that was not so into crafting had left a comment saying that they still felt that they may be encouraged to try the new system if its results were worthwhile.

That's it for this week's post. Not too much to report really, as much of what I have done is going over old stuff, or trying to understand other stuff that I have yet to put to use. Hopefully, in the coming weeks, I will be more productive and have more to report.