Revolverocelot11 Posted August 3, 2012 Share Posted August 3, 2012 (edited) As the title says I need to find a way to delete an item when it is dropped. I've scripted a weapon that takes count of an object in an actor's inventory and then modifies the damage based on that value. Then I scripted an effect that adds these objects to the player whenever the player deals damage with the weapon (via enchant). These objects are scripted to remove themselves whenever the player is not in combat (or dead if equipped to another actor). All of these work correctly, the only thing I've found was players could still drop this item which I don't want them to be able to do. I'm kind of new to the creationkit and I haven't worked much with quests yet so I couldn't find a way to tag them as quest items but I figured I could do the same thing via script. I scrippted it so when the container changes and there is no new container (i.e. it is dropped out of a container into the world) it deletes itself however that doesn't seem to work. Anyone know either the correct context or another way to delete an item on drop. Here is the code snippet for reference: ScriptName Combopoint Extends Form ObjectReference Property ZMisc03 Auto ; Zmisc03 is the object that this script is attached to Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) If akOldContainer && !akNewContainer Debug.Notification ("Combo Points cannot be dropped") ; Alerts the player that these can't be removed akOldContainer.AddItem(ZMisc03) ; Adds the item back to the player so that it appears that nothing has changed ZMisc03.Delete() ; deletes the item that this script is attached to The object is a copy of the coin (just renamed with the script on it) and I read somewhere in my searches with disable() it doesn't always work on small objects. Could the same be true with delete()? Or am I just miss-understanding the function? Note: Incase your wondering there is no endif because it is an else event and theres more code below, however this is the only part i need help with Edit: I also wanted to throw in there that I don't normally comment my scripts so I added them in there for the snipit to make it easier for others to read. I don't think I added them in quite right but you can ignore that; The comments arn't the issue here. Edited August 3, 2012 by Revolverocelot11 Link to comment Share on other sites More sharing options...
Recommended Posts