Jarrek2002 Posted December 20, 2016 Share Posted December 20, 2016 Hello, I just can't seem to get a script working using the OnItemAdded event. What I'm trying to do:- For every Iron Arrow that the player picks up, an object is added into his inventory Mod set up:- Created misc item titled "arrowitem"- Created formlist titled "arrowform", that contains an iron arrow- Created Quest that starts enabled- Created the player as the reference alias for the quest- Created a script and attached to the reference alias Script: Scriptname âArrowadd âextends ReferenceAlias Actor property PlayerRef âAutoFormlist property ArrowForm AutoKeyword property VendorItemArrow AutoForm property ArrowItem Auto Event OnInit() AddInventoryEventFilter(ArrowForm)endEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if akBaseItem.HasKeyword(VendorItemArrow) PlayerRef.AddItem(arrowitem, aiItemCount, true) endifendEvent I know the quest and player alias are working correctly as I've added a test note to the Alias Inventory, which appears in the player's inventory. Otherwise, the script does not seem to recognize when I pick up an Iron Arrow at all. Any help would be much appreciated! Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 20, 2016 Share Posted December 20, 2016 1. The ArrowItem property should be Ammo rather than Form.2. Is the arrow listed on the formlist used in the inventory event filter? If not, that would be a contributing factor.3. Have you assigned the appropriate data to the properties in the Creation Kit? If not, that would be a contributing factor as well. Link to comment Share on other sites More sharing options...
Jarrek2002 Posted December 20, 2016 Author Share Posted December 20, 2016 (edited) 1. The ArrowItem property should be Ammo rather than Form.2. Is the arrow listed on the formlist used in the inventory event filter? If not, that would be a contributing factor.3. Have you assigned the appropriate data to the properties in the Creation Kit? If not, that would be a contributing factor as well. Thank you for your reply Ishara1. Ok, I corrected the property - I'm using a MiscObject "BearPelt" just to test2. Yes, the inventory event filter "arrowform" contains an Iron Arrow (only)3. Properties are all assigned in the CK as you suggested The script now appears as follows: Scriptname Arrowadd extends ReferenceAlias Actor property PlayerRef AutoFormlist property ArrowForm AutoKeyword property VendorItemArrow AutoMiscObject property BearPelt Auto Event OnInit() AddInventoryEventFilter(ArrowForm)endEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if akBaseItem.HasKeyword(VendorItemArrow) PlayerRef.AddItem(BearPelt, aiItemCount, true) endifendEvent Edited December 20, 2016 by Jarrek2002 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 20, 2016 Share Posted December 20, 2016 Does it work or not?Make sure you are using the correct iron arrow. There are several entries of iron arrow in the ammo section. You should be using 0001397D. Are you testing on a new game or a save that has not seen your mod before? Old information from your mod could be baked into the save and preventing the newly added stuff from working as intended. Link to comment Share on other sites More sharing options...
Jarrek2002 Posted December 20, 2016 Author Share Posted December 20, 2016 Does it work or not?Make sure you are using the correct iron arrow. There are several entries of iron arrow in the ammo section. You should be using 0001397D. Are you testing on a new game or a save that has not seen your mod before? Old information from your mod could be baked into the save and preventing the newly added stuff from working as intended. It's working now! Thank you so much! I believe the latest issue was that I was working on an existing save. Your help is much appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts