RemoveItem AddItem NPCs

Post » Sun Feb 01, 2015 11:07 pm

The problem is to transfer an amulet from one NPC to the next at the end of a scene.

Scriptname BenduToGilfre extends scene Hidden   ReferenceAlias Property Bendu  Auto  ReferenceAlias Property Gilfre  Auto  ReferenceAlias Property Amulet  Auto MiscObject property Gold001 auto Function MyFunction()Actor rBendu = Bendu.GetReference() as ActorActor rGilfre = Gilfre.GetReference() as ActorObjectReference rAmulet = Amulet.GetReference() as ObjectReference;rBendu.RemoveItem(rAmulet, 1, false, Gilfre) ideally give to Gilfre casted as ObjectReference (fails)rBendu.RemoveItem(rAmulet)rBendu.AddItem(Gold001, rAmulet.GetGoldValue() * 2)rGilfre.AddItem(rAmulet)EndFunction

The script functions insofar the amulet is removed, but it is not to be found on the recipient NPC.

This scene plays in a quest, and the amulet is a quest item.

However it is flagged as stolen in Bendu's inventory.

User avatar
Assumptah George
 
Posts: 3373
Joined: Wed Sep 13, 2006 9:43 am

Post » Mon Feb 02, 2015 5:40 am

you can't move an item into a reference alias, as the "gilfre" in your script is

go rBendu.RemoveItem ( rAmulet, 1, false, rGilfre ) and it should work.

User avatar
Paul Rice
 
Posts: 3430
Joined: Thu Jun 14, 2007 11:51 am


Return to V - Skyrim