PatrickTheDM Posted June 23, 2016 Share Posted June 23, 2016 Normally I can find an example to work off of, but this one has me stumped. I want to create a triggerbox that when the player walks into, it removes all items and places them in a chest. I know how to make the trigger part and define the chest, but how to use the function is what I can't figure out. Scriptname RemoveAllItems extends ObjectReferenceObjectReference Property PlayrtItemChest AutoEvent OnTriggerEnter(ObjectReference akActionRef)If akActionRef == Game.GetPlayer()Function RemoveAllItems(ObjectReference akTransferTo = None, bool abKeepOwnership = false, bool abRemoveQuestItems = false) nativeEndIfEndevent Obviously this does not compile. I can't figure out how to set up the function. The Function line is copied right out of the CK tutorial page. Link to comment Share on other sites More sharing options...
FrankFamily Posted June 23, 2016 Share Posted June 23, 2016 (edited) Read here the difference between function definition and function call: http://www.creationkit.com/index.php?title=Function_Reference That you have there is the function definition, you want to call it, so check the examples at the bottom of the page: http://www.creationkit.com/index.php?title=RemoveAllItems_-_ObjectReference Scriptname RemoveAllItems extends ObjectReference ObjectReference Property PlayrtItemChest Auto Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() akActionRef.RemoveAllItems(PlayrtItemChest) EndIf Endevent Edited June 23, 2016 by FrankFamily Link to comment Share on other sites More sharing options...
PatrickTheDM Posted June 23, 2016 Author Share Posted June 23, 2016 (edited) Thank you very much FrankFamily! :smile: I'm a fan of your work. Now that I see your script it makes a lot more sense. The akActionRef is what was confusing. I thought I would need to also define the player, but you just helped me see a part of this that didn't click before. Edit: I just tested it and it worked perfectly. Quest items are kept on the player nice and safe too. :D Edited June 23, 2016 by Asaforg Link to comment Share on other sites More sharing options...
Recommended Posts