THE FORGE OF WONDERS
Version 1.03
by Nigel Kearney (nigel_k@yahoo.com)

To install and run, extract the 'Forge of Wonders.mod' file to your NWN modules folder, then run NWN and select 'New' and 'Other Modules'. You need the 'Hordes of the Underdark' expansion to use this module.

The Forge of Wonders is a utility module consisting of one area with the following NPCs:

- A smith who modifies items. Most of the item properties available in the toolset can be added by the smith. To use the smith, place a single item on the anvil and then speak to Goignar the Smith. The cost is the difference between the item value with and without the modification. If you reduce or remove a property, you will get a refund. Note that NWN's valuation method means that adding a property to a low value item is cheaper than adding the same property to a high value item. For example, if you want +10 strength, instead of just adding a +10 str bonus to your weapon, it will work out cheaper to add +3 str to two of your cheapest items and +2 str to your two next cheapest items.

- A trainer who provides experience or gold on request. This is useful when modules require a character of a specified level. Start the Forge of Wonders with a new or existing character and use the trainer to modify your level or gold as required, then export the character and start your desired module by choosing 'pre-existing character' and selecting the one you exported. As a rough guide, when levelling up characters in this way, I give them a number of gold pieces equal to 150% of their experience points.

- A merchant who sells all the items included in the toolset. I've set the merchant to buy and sell items at cost, because I usually change my mind several times while creating characters and want to swap items. If you wish to use this merchant in another module, you should probably change the buy and sell rates. There are multiple merchant objects so you need to change them all.

The Forge of Wonders can be used to build up characters for use in other modules, or could be included as part of a module. If used as part of a larger module, you'll probably want to delete the merchant and trainer, and may also wish to add a multiplier to the cost of item modifications.

Please feel free to use and/or distribute this module as you wish, with or without modifications.

Send bug reports or comments to nigel_k@yahoo.com


Programming Notes
~~~~~~~~~~~~~~~~~

Don't be put off by the huge number of functions! Over 90% are one-liners, necessary because of the way the NWN toolset works. Every property that can be added to an object requires a separate function. The actual work is done in the following routines:

calcmodvalue1   - Creates a copy of the item and modifies the copy
calcmodvalue2   - Gets the value of both the original item and the copy, the destroys the copy
cannotafford    - Returns true if the PC has insufficient gold for the modification
isitemonanvil   - Checks that exactly one item is on the anvil, also stores the item object and name
ismeleeweapon   - Returns true if the item on the anvil is a melee weapon. Some properties apply to melee weapons only.
israngedweapon  - Returns true if the item on the anvil is a melee weapon. Some properties apply to ranged weapons only.
isweapon        - Returns true if the item on the anvil is a melee weapon. Some properties apply to weapons only.
itemprocs       - Property creation and addition functions used by both calcmodvalue1 and modifyitem. 
levelchange     - Calculates the amount of experience required for a specified level, i.e. level * (level - 1) * 500
modifyitem      - Performs the actual modification and takes or refunds gold.

The reason for calcmodvalue1 and calcmodvalue2 being separate functions is that I encountered an occasional bug when an existing property was modified (e.g. increasing enhancement bonus from +2 to +3). The gold piece value of the modified item reflected the added property, but did not reflect the removal of the original one, therefore the player was overcharged. Splitting the functions allows the valuation of the copy to be attached to a separate conversation node from the creation of the copy. This results in a time delay which seems to circumvent the bug.


Version History
~~~~~~~~~~~~~~~

04-JAN-2004  v1.00  Public release
05-JAN-2004  v1.01  Fixed bug with miscellaneous immunities not being added
18-JAN-2004  v1.02  Added massive criticals property for weapons
28-JAN-2004  v1.03  Added weight reduction
                    Added reduced arcane spell failure
                    Added unlimited ammo for ranged weapons
                    Added vorpal (under weapon on hit properties)
                    Added crafting components to the merchant