Page 1 of 1

DestroyItem

Posted: Wed Oct 18, 2006 12:59 am
by goldfish
Would it be possible to add a flag to DestroyItem, so we can choose if it runs its unequip script? Be pretty handy.

Posted: Wed Oct 18, 2006 2:33 am
by Yukiko
This can be scripted in the DestroyScript for the item.

Posted: Wed Oct 18, 2006 9:28 am
by Marilla
You could do something like this:

Code: Select all

var item := whatever...;
SetObjProperty(item, "#nounequip", 1);
DestroyItem(item);
Then, in the UnequipScript, simply test for the #nounequip cprop. I recommend returning 1 to allow the item to be unequipped, even if it's also being destroyed.

I also recommend you make it a #-prefixed cprop so that accidental settings of the prop don't eat up save file space. However, if you have situations where you KNOW a certain item should NEVER run an Unequipscript, you could use a permanent cprop, instead (so that you don't need to use two different ones)