Sleight of hand - What am I missing?

I’m getting so frustrated. I’ve been at this for about 2 hours now. I’ve created a custom item that I’ve placed on an NPC. The PC and his companions is supposed to steal this item from the NPC. I’m using my level 5 rogue PC in game with the Sleight of Hand skill. When I try using the Sleight of Hand skill on the NPC the NPC isn’t clickable so to speak, you can’t perform Sleight of Hand on the NPC. What am I missing?

The item I created is an amulet. I set Droppable to True and Pickpocketable? to True on the item properties. Then when placing the amulet in the NPCs inventory I check the amulet again as Droppable and Pickpocketable. I’ve set the NPC properties Disarmable to True and Lootable Corpse to True. Maybe I’m supposed to also change something in the Scripts section (Maybe the OnDisturbed script?) of the NPC…or something?

Isn’t this supposed to work? I must be missing something fundamental here. I’m going crazy.

1 Like

Have you tried holding (or just pressing) right click on the npc and seeing if there’s a pickpocket option from the drop down menu? Like attack ecc…

1 Like

Yes, I have right clicked on the NPC but there is no option for pickpocketing as far as I can tell. So, I’ve instead selected the sleight of hand skill from the menu of the PC character but the icon doesn’t light up when going over the NPC, so there the NPC is not clickable either. It must be something I’m missing…

1 Like

Is the npc someone you can take hostile actions on? Such as having the “can attack neutrals” or whatever option turned on for your module/campaign. Iirc that’s necessary as pickpocket is a hostile action.

Another way to handle it is to actually have a conversation with the npc, and make the sleigh of hand check in conversation.

I have a pickpocket quest in Crimmor, so I can check later.

1 Like

Aha. That must be it. The NPC character is friendly.

Where do I find “can attack neutrals”? Is it in the OnModuleLoad script or something like that?

1 Like

Ok, so I’m half way there solving this now. This NPC is already part of a custom faction that is friendly towards the PC. I changed under View/Faction the relationship between the PC faction and this faction to 50 instead of 100, thus making this faction neutral to the PC. And now I could do Slight of Hand on the NPC. However, if one fails the NPC doesn’t get hostile which would be really neat if it got hostile. Maybe one could change that in the OnDisturbed script?

1 Like

Unfortunately pickpocketing non-hostiles is something the game just doesn’t really handle well. For instance I don’t believe OnDisturbed runs if the inventory isn’t disturbed (ie the pickpocket attempt fails).

1 Like

Try this on the NPC’s OnInventoryDisturbed handler. It should only fire if the pickpocket attempt was DETECTED, not just if it fails, causing the NPC to go hostile.

#include "nw_i0_generic"
#include "x0_i0_spawncond"

void main()
{
	object oTarget = GetLastDisturbed();

	if (GetIsObjectValid(oTarget) && !GetIsFighting(OBJECT_SELF))
	{
		DetermineCombatRound(oTarget);
	}

	if(GetSpawnInCondition(NW_FLAG_DISTURBED_EVENT))
	{
		SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DISTURBED));
	}
}

Be careful if you put this on a plot NPC. He could potentially go hostile because of a pickpocket gone bad, thus breaking a quest or important dialog.

3 Likes

Thank you, kamal and travus! I’ll try with travus’ script and see if it works. If it works when the attempt is detected I’m pleased. I mean, it feels logical that the NPC would attack the PC if it notices the PC trying to steal things from him.

1 Like

Your script worked as you described, travus. Again, thank you!

Another question. As the Sleight of Hand skill is described it says the DC is 20 for neutral characters and 30 for hostile characters. Is there any way to change the DC to 30 for neutral characters or is this maybe hardcoded into the game?

2 Likes

Yes, the base DC is hardcoded. There’s no way to change this (unless you’re going to write your own pickpocketing system with a custom UI).

1 Like