Scripting Help for Blacksmith

I’m wondering if anyone could help out with a particular script. Basically I want a script that checks to see if a weapon(any type) is made inside a blacksmith table. If one has been made then a journal entry is triggered. If not . . . no big deal.

Any takers?

2 Likes

You could make a custom smithhammer activate script like so:

// i_smithhammer_ac

#include "ginc_crafting"

void CheckInventory(object oTarget)							// new
{															//
	if (GetWeaponType(GetFirstItemInInventory(oTarget)))	//
	{														//
		AddJournalQuestEntry("test1", 1, GetFirstPC());		// <-- enter your quest name and state here
	} 														//
}															//

void main()
{
	object oPC      = GetItemActivator();
	object oItem    = GetItemActivated();
	object oTarget  = GetItemActivatedTarget();
	location lTarget = GetItemActivatedTargetLocation();
	string sTargetTag  = GetTag(oItem);
	int bSmithHammerRenameItem = GetGlobalInt(CAMPAIGN_SWITCH_SMITH_HAMMER_RENAME_ITEM);
	
	if (IsSmithWorkbench(oTarget))
	{
    	AssignCommand(oTarget, DoMundaneCrafting(oPC));
		DelayCommand(1.0f, CheckInventory(oTarget));		// new
	}
	
	else if (bSmithHammerRenameItem && (GetObjectType(oTarget) == OBJECT_TYPE_ITEM))
	{
		SetEnchantedItemName(oPC, oTarget);
	}
	
	else ErrorNotify(oPC, ERROR_UNRECOGNIZED_HAMMER_USAGE);
}
3 Likes

Thanks man. I’ll give it a whirl. Wasn’t really sure how to approach it.

3 Likes