Giving NPCs Pickpocketable Items
From FleshWorks
by ProjectX
Contents |
Introduction
Pickpocketing items wasn't used much in OMs but the technique was. Often the technique was used for adding keys, or torches to guards. We will focus on adding a bag of loot and a bracelet to an NPC. The technique is the same as adding a lock to a door.
The Purse
Getting Started
Create your level and add your NPC (in the actor browser got to pawn -> AIPawn -> T3AIPawn and then choose a category and AI) to it that you want to be pickpocketable. (You can also give it patrol paths, etc. but that's covered in a different tut.)
Next go to the actor browser and select WorldObj -> InventoryObject -> Loot -> Purse and then select SmallCityPurse and add it to the level, preferably somewhere near the NPC.
Setting up the Links
Select the purse and right-click it. Now select properties, you'll notice that the name of the item appears at the top of the properties box in brackets at the end (in my case it is SmallCityPurse__0). Remember that name.
Select the NPC and right click. Select Actor Links and a new window should open. Select AddLink and when yet another window opens choose Rigid Attachement from the list. The FROM bar should already be filled in with the NPCs name, but the TO bar should be blank. Fill this box with the name of your pruse (for me it is SmallCityPurse__0). Click OK and then DONE on the two windows.
Wearing the Purse
Now you'll have noticed that the purse appears in between the NPC's feet, and unless your NPC's a football star (soccer for you Americans) this would look quite weird. Select the purse and right click. Then select actor links - a familiar window should appear. This time select the link between the NPC and the purse (it was automatically created for the purse when you added the link to the NPC) and click EDIT. A property window has now opened, expand properties -> Attachment and select m_ParentBone. Click the ... button and select where you want to put the purse on your NPC (as far as I know all the ones we'll need begin with HP_) I would recommend HP_LeftHip or HP_RightHip because we don't want to mesh the purse and your NPC's head together do we? Finally select the m_attachmentbone and choose HP_itemattach. This part rotates the item into position. Other options are available for attachment and we shall use them in the next section
NOTE: If the purse hasn't changed location then move the NPC slighly. The location should update. Sometimes the objects attached look odd in the editor (like meshed halfway through a hand) but upon rebuild or in the game they should look fine.
The Bracelet
Getting Started
Add a Bracelet from the loot category that we got the purse from and put it near our bepursed NPC. Add the links to the NPC for the bracelet as we did for the purse (sometimes it will pop up a viktoria error telling you that the actor already has a link with rigidattachment to an object, but that doesn't matter, just click continue). DO NOT SET THE PARENT_BONE UP YET!
The Only Change we make
Right we've set it all up properly except the bracelet is still beneath our NPCs legs. Go into the actor link editor for the bracelet and click edit on the link. Under m_ParentBone select HP_LeftHand or HP_RightHand and then yo'll have to change m_AttachmentBone (otherwise the bracelet is rotated incorrectly) to HP_Attachment. That's it!
Final Words
That should teach you fully how to fully add stealable objects to players. If there are any errors tell me on the forum thread: Threadage
Alternate Method
Note - I am writing this from memory, so it may not be entirely accurate.
There is in fact another way to do this, using 'Edit Weapon Loadout'. Place your AI as before, then right-click it and select Edit Weapon Loadout. Click 'Make Local' in the dialog box that appears. If your AI has a weapon, you will notice it listed here, either on the Left Hip, or the Shoulder. To add an item to pickpocket, select Right Hip and click Add Item to Slot. A list of items you can add will open. Simply select one and click OK.
Not all items can be added in this way. I expect there is a property which allows it, but I do not know what it is.
Back to Mission Design: AI Tutorials Page
