Well met all. Here is the method to create a blacksmith out of any NPC. Follow these steps, and you should have an NPC that beats on an anvil, and casts a few smith style spells to add a bit of sex appeal.

First, create an anvil, and paint it anywhere on the map. Make sure it is a static object, and set its hardness = 100 and its hit points = 1000. Now, set its tag to "anvil" instead of "Anvil", and make sure it is
hostile.

Second, paint an NPC facing the anvil close to it. Equip it with a hammer, and set its movement rate (under the statistics tab) to Immobile. The NPC will still hammer at the anvil and cast spells, but it will be frozen in
that spot (so make sure the smithy is well guarded).


Third, place this custom script within the NPC's On Heartbeat script event:


//Begin Script
/* Tag is set to "anvil" for this script. If your anvil has a different tag,
then either change this script by replacing "anvil" with "<your anvil's
tag name>" or change the tag of your anvil to "anvil" */

void main()
{
switch(d4()) //will switch between hammering and casting spells
{
case 1:
{
ActionCastFakeSpellAtObject( SPELL_BLESS, GetObjectByTag( "anvil" ));
}
case 2:
{
ActionCastFakeSpellAtObject( SPELL_HAMMER_OF_THE_GODS, GetObjectByTag( "anvil" ));
}
case 3:
{
ActionAttack( GetObjectByTag( "anvil" ));
}
case 4:
{
ActionAttack( GetObjectByTag( "anvil" ));
}
}
}
//End Script

Forth, you need to add this custom script to the OnSpawn and On User Defined script events:

//Begin Script
//:://////////
//:: Custom User Defined Event
//:: FileName
//:: Copyright (c) 2001 Bioware Corp.
//:://////////
/*

*/
//:://////////
//:: Created By: Dindaban
//:: Created On:
//:://////////

void main()
{
ActionAttack( GetObjectByTag( "anvil" ));
}
//End Script

And now, you should have a working blacksmith. Post a reply to this message if you have problems.

Here are the urls of some screenshots I took of the working smithy (a word of caution, these screens are on a tripod server, and as we all know tripod sucks. This should be changed soon though):

Click Here
Click Here
Click Here
Click Here
Click Here

Enjoy.

-Dindaban

EDIT: make sure you give the NPC a hammer AND that he has the Feat (weapon familiarity:Martial) required to use it.