Help - Search - Members - Calendar
Full Version: Builders - NWN Scripting
Siala Forums > Основные форумы: > Основное общение
Bes Inc.
Georg Zoeller
Designer


Joined: 27 May 2003
From: Edmonton, AB Posted: Wednesday, 03 December 2003 03:53AM
What's New

There are about 140+ new scripting commands in Hordes of the Underdark. I will try to add specific examples and hints into this thread in the coming weeks.

Version Notes

All functionality discussed in this thread requires version 1.59+ which comes with Hordes of the Underdark. At the moment we expect to release a patch that will bring both the orignial NWN, NWN:SoU and HotU to version 1.60 in the seconds week of December.

Getting Started

What follows is a short "Getting Started" section for those who want to jump on the new functionality right now:


Creature Related Scripting Commands

You can find a small list of new creature related scripting commands in HotU we released at a neverwinter wednesday a while back here: Click Here


Global Switches

NWN:HotU has a selection of variables that can be set to override the default behavior/rules in the game.
Examples include:
- Activating/Deactivating the Use magic device skillroll for rogues
- Toggle if the WalkWaypoints command makes creatures cross area borders
- Enable/Disable the New Item creation feats
- Modify a creatures AI behavior (i.e. %of magic use, compassion, offense, etc)
- and a lot more

All these options are documented in a file called x2_inc_switches.nss. To see an example on how to configure them for your module, open the file x2_mod_def_load.nss which is automatically attached to the OnLoad slot of each new module created with Hordes of the Underdark. I will add more detailed information about how to write your own additions to the combat AI and how to modify the default AI behavior later in this thread.


Dynamic Item Properties

To get started with dynamic item properties, I suggest the file x2_inc_itemprop.nss which holds wrapper functions for most of the common tasks you will encounter when dealing with dynamic item property scripting. The file is reasonably well commented so an experienced script shouldn't have too much trouble to find out what's going on.

To see examples of how to add item properties to an item, I suggest the new HotU spellscripts for i.e. magic weapon (x2_s0_magcweap.nss), holy sword (x2_s0_holyswrd.nss), or flame weapong (x2_s0_x2_s0_flmeweap.nss)

You may want to have a special look at the function IPSafeAddItemProperty which is the universal wrapper function used throughout the HotU Spellscripts when it comes to adding itemproperties. It takes care of most problems that can arise (ie. preventing a temporary item property from removing a permanent one, etc). I will post code examples about this later.


On Hit Cast Spell

With HotU, you can create your own OnHit spells for weapons and armor, in addition to the spells already available in the toolset (much like the CastSpell:Unique Power ability).

In order to add your own custom OnHitCastSpell to a weapon, you first need to add the OnHit: Cast Spell - Unique Power property to the weapon or armor in question.
Then pen and modify the the file x2_s3_onhitcast.nss in your module. The file is well commented so you should have no trouble to figure out what to do. I will post some code examples about this topic later.


Item Event Routing

Any new module created with the Hordes of the Underdark toolset has a couple of default script attached to its events. These default script allow routing of item specific events into a single file, so you need to have only one script file that contains all the scripts for your items.

Note that this feature only works if you have the default xp2 module scripts on your module (or added the appropriate code to your custom scripts).

To get started, have a look at the file x2_it_example.nss, it should be well enough commented to get you started on that topic. I will add a short example on this topic later.


User Talktables, Adding new spells and feats

The excellent, community made Custom Content Guide already has the information required to use the new custom talktables in scripting and how to add new feats and spells.


Pre 1.60 / HotU

The previous version of this thread that had information about the Shadows of Undrentide/Patch 1.30 scripting specific additions can be found here:

Adding Crafting Materials to your campaign

In order to allow your players to use their crafting skills, you need to make sure that crafting materials are available to them.

The easiest way to do that is to add the script x2_o2_dead.nss to the OnDeath event of destroyable placeables and Doors, like it is used in the Official HotU campaign. This will cause the placeable/door to drop some crafting materials if it is destroyed by a character skilled enough in crafting (craft armor or craft weapon 5+) to salvage the material.

The materials that are dropped by this script are defined
in des_crft_drop.2da where the row index in that file corresponds to the appearance type of the placeable/door/creature calling the script. You do not need to distribute a customized version of this file if you make any changes to it (i.e. via hakpak), as the script using the file is server side only (this way you can hide your drop tables from your players).

The default death scripts will take care of dropping creature related material (i.e. hides, feathers or metal for certain types of golems).

How to add more dyekits

Horde of the Underdark comes with about 15 different colors for each of the 3 dyetypes (leather, cloth, metal). Of course this won't be enough for a lot of people, so here a quick guide on how to add a new dyekit.

1. Create a new misc. small item with the dyekit icon (or whatever), best by copying an existing dyekit

2. Add the appropriate Item Property: Cast Spell properties to it:

Example: Leather Dye - Add the following properties
Cast Spell: Dye Leather 1 (1 charge / use)
Cast Spell: Dye Leather 2 (1 charge / use)

3. Set the number of charges to the item (we use 5 charges for the official dyekits) and modify the cost to suit your module's economy

4. Here comes the somewhat tricky part: Defining the color. In order to define the color of your dyekit, you need to set its tag according to the following rules:

MyTagXX

where MyTag is any string you want up to 14 chars, and XX is a two digit number between 0 and 63 that represents the color the dyekit will have. To find ouy the number of a color, you need to open the armor color palette in the toolset (i.e. by editing an armor) and count on that palette from left to right, starting 00 in the first row until your reach the color you want to your dyekit to have.

Example: If you want your metal color dyekit (CastSpell: Dye Metal 1 & 2) to give red color, the tag of your new dyekit needs to end with the digits 24. (I'll eventually add a picture link here, maybe someone from the ccg can make one )

5. Save your dyekit and put it into your module and it is ready to go. You might want to create a copy of the Dyekit merchant in the store's palette that has your custom dyekit in the selection.

So in the end, if you want a dyekit for every color, you will have to create 2x 64 items (minus the ones that already exist) that will have tags from MyTag00 to MyTag63.

If you are interested in the script that is used for the dyekits, have a look at x2_s2_dyearmor.nss.

In case you are wondering why I am stripping any temporary item properties from the dyed armor in that script: the CopyAndModifyItem (and CopyItem) scripting command causes the item properties on the armor to be detached from their creator (as the object id changes) and since the time for temporary effects and properties is tracked on the creator, existing temporary properties (i.e. from a magic vestment spell) would never go away from the dyed armor until the player logs out. Removing all temporary item properties prevents that from happening.
Ninja
Бес, а вот взял бы да на русским это все отпостил, не многие понимают хорошо инглиш...!!!
Bes Inc.
я литературно не переведу, да и времени на перевод нет к сожалению, можно Фата или Андрея попросить, они всё равно скучают rolleyes.gif
Ferdinand
кто скриптами занимается, тот понимает smile.gif мда весело

видимо придется всетаки ставить аддон sad.gif
Bes Inc.
однозначно ставить-)
Mage
тогда боюсь и вещей новых надо делать, и свитков, и т.д. И мобов крутых.
Ferdinand
Ну, ребят, вы сначала докачайтесь, а мы за это время и мобов настругаем, и шмоток для 40 лвла smile.gif
Bes Inc.
все будут играть а мы стругать.. не карашо unsure.gif
Mage
такая уж ваша доля smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.