BioWare Atari
BioWare Info BioWare Games Support Forums Visit the BioWare Store
Neverwinter Nights Home
Neverwinter Nights Home
Sections: New Creatures & Placeables | New Tilesets | New Scripts

Go to (Previous  - 1. About, 2. Introduction, 3. Script: Set Name, 4. Script: Set Wing, 5. Commands - Next )



Georg's Scripting Extreme Close-Up I: Set Name

By Georg Zoeller

This article discusses new scripting commands introduced in the 1.67 Update and demonstrates one possible way of using these commands to add interesting new features to a module or persistent world.

This article assumes the reader is somewhat proficient with Neverwinter Script, but a demo module and downloadable .erf is provided for simple import and text.

SetName

This powerful, new scripting command allows the module builder to change the name of in game items, creatures and placeable objects, allowing for truly random content generation while adding personality to your NPCs.

Image 1 - Bag 'o Scripting Booty: Georg's Scripting Extreme Close-Up I: Set NameNote that the scripting command can not be used to change a player character's name.

This new scripting commands enables builders add a number of new things to their modules which could not done before patch 1.67, such as:
  • Personalized item names (such as Lilac's Mace +1).
  • Create named gravestones on a player's or creature's death.
  • Treasure Systems dropping custom monster treasure (Big Bad Demon's Whip).
  • NPCs starting off as "Generic Peasant" and changing their name to "Craig the Rancher" after the player talks to them.
  • Crafting Systems that adjust the name of items based on their properties.
  • Truly random quest content generation. ("Find Vulcano's Lute!")
  • Random creature names generated based on race, alignment, class or weapon specialization ("Tasha Swiftaxe").

New Game Functionality - The Built in Name Generator

With patch 1.67, the default OnSpawn script for the game (nw_c2_default9.nss) has been update to include an easy to use Random Name generator for creatures placed in the toolset.

The Variables Dialog can be found on the Advanced tab of the creature properties dialog in the toolsetBy setting the integer variable X2_NAME_RANDOM on any creature template in the toolset palette, a module builder can tell the game to generate a unique random name for any creature based off that creature template (Note: Already placed instances are not automatically updated with the variable).

The "Variables" Dialog can be found on the "Advanced" tab of the creature properties dialog in the toolset

Because we know that builders like to have the maximum level of control over content in their module, we also added functionality to allow a module creator to override the default name generator used by the game (RandomName()) with a custom, more sophisticated script of the builder's choice.

Creating A Custom Name Generator

To override the default name generator used at creature spawn when the aforementioned variable is set, a module builder can create a script named "x3_name_gen.nss" in the toolset, which will automatically be executed when a creature is spawned and tries to generate a random name.

An Example Custom Random Name Generation ScriptTo designate a return value for the script, containing the creature name that is supposed to be used, x3_name_gen.nss needs to set a local string "X3_S_RANDOM_NAME" on OBJECT_SELF (the creature just being spawned).

Download this example as .erf

Example Application: Updating NPC Names

Builders - In addition to the examples provided in the text above, the 1.67 demo module demonstrates some additional use for the function:

  • An example "Item Branding Device" item that imprints the name of the owner on an item when used.
  • A house the player can own complete with matching key and road sign.

Players - You can test this functionality by downloading the demo module. The store in this module features a "Signet Item" that can be used on any item (such as a weapon) to imprint your name onto it. (i.e. Torias' Axe +2)


 

 

BioWare Blog
Neverwinter Nights 2 Forums
Hide/Show

English
Deutsch
Français
Español
Italiano

Hide/Show

View Latest Screenshots 

View Latest Screenshots
Hide/Show

Multiplayer Games at Neverwinter Connections

Today
Schedule a Game...



Current time is: (set time)
Sun, 08 November 2009 02:06AM

Hide/Show

Buy Premium Modules

Top NWN: HotU Modules:
1. Good vs Evil III
2. More...

Top NWN: SoU Modules:
1. Good vs Evil III
2. More...

Top CEP Modules:
1. The Lord of Terror The Diablo Campa...
2. More...

Top Modules - NWVault:
1. Hall of Fame
2. More...

Total Modules: 4423

Hide/Show

4,826,942 BioWare Users:
  200 Logged In
  8 Hidden
  1259 Guests

1295 Playing Online
  100% NWN
  99% NWN: SoU
  99% NWN: HotU

446 Registered Guilds

8,715,015 posts in forums

Newest Forum Topics:
1. Arcane Warrior Gem (Dragon Age: Origins Story and Plot (Spoilers) Forum)

2. Must say, I'm impressed with Ali... (Dragon Age: Origins General Discussion)

3. Can't find registration code (Dragon Age: Origins Technical Assistance (Self Help))

4. Dragon Age Patch and Boot (Dragon Age: Origins Technical Assistance (Self Help))

5. Morigann's nips? (Dragon Age: Origins General Discussion)