Jump to content

RemoveAllItems script needed


Recommended Posts

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 ObjectReference

ObjectReference Property PlayrtItemChest Auto

Event OnTriggerEnter(ObjectReference akActionRef)
If akActionRef == Game.GetPlayer()

Function RemoveAllItems(ObjectReference akTransferTo = None, bool abKeepOwnership = false, bool abRemoveQuestItems = false) native

EndIf

Endevent

 

 

 

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

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 by FrankFamily
Link to comment
Share on other sites

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 by Asaforg
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...