Jump to content

[LE] Auto-Delete Item Script


Recommended Posts

This is my first script so bare with me. The goal is to have it automatically disable/delete the weapons and armor if they are dropped from the inventory into the game world or moved into a different container. So far, I've managed to get it to work when dropped into the world, but it will not delete the item once it has moved into a container. Can anyone tell me what I'm doing wrong?

Scriptname __fade extends ActiveMagicEffect
{My first script!}

Event OnItemRemoved(Form akForm, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
  debug.messagebox("item removed: form=" + akForm.GetName() + ", item=" + akform)
	  if akForm == my_armor || akForm == my_armor2 || akForm == weapon1 || akForm == weapon2 || akForm == weapon3 || akForm == weapon4
		if akDestContainer
			debug.messagebox("put in container")
			akItemReference.Disable()
		   Debug.Trace("The item dissipates as I let go of it.")
	  else
			debug.messagebox("dropped on ground")
			akItemReference.Disable()
		   Debug.Trace("The item dissipates as I let go of it.")
	  endIf
  endIf
endEvent

Armor Property my_armor  Auto  

WEAPON Property weapon1  Auto  

WEAPON Property weapon2  Auto  

Armor Property my_armor2  Auto  

WEAPON Property weapon3  Auto  

WEAPON Property weapon4  Auto  

Armor Property armor_light  Auto  
Link to comment
Share on other sites

As IsharaMeradin said.


You could also do 2 EVENTS:


Event OnItemRemoved(Form akForm, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) > Just for the "dropped on ground"


Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) > Just for the "put in container".

Link to comment
Share on other sites

  On 5/15/2019 at 12:51 PM, maxarturo said:

 

As IsharaMeradin said.
You could also do 2 EVENTS:
Event OnItemRemoved(Form akForm, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) > Just for the "dropped on ground"
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) > Just for the "put in container".

 

They could but then they'd have to condition both to rule out the other. Better to stick with a single event and handle both scenarios within.

Link to comment
Share on other sites

  On 5/15/2019 at 2:00 PM, IsharaMeradin said:

 

  On 5/15/2019 at 12:51 PM, maxarturo said:

 

As IsharaMeradin said.
You could also do 2 EVENTS:
Event OnItemRemoved(Form akForm, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) > Just for the "dropped on ground"
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) > Just for the "put in container".

 

They could but then they'd have to condition both to rule out the other. Better to stick with a single event and handle both scenarios within.

 

Yeap... you're right...

Link to comment
Share on other sites

Just in case you want to modify your effect script. Keep in mind unique script names are very important!

 

hesAutoRemoveMGEFScript

  Reveal hidden contents

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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