SetDroppableFlag(object, int)

Marks an item as droppable or undroppable.

void SetDroppableFlag(
    object oItem,
    int bDroppable
);

Parameters

oItem

Item to set the droppable flag of.

bDroppable

Determines if the item is droppable (TRUE if it can be dropped, FALSE otherwise).


Description

Sets the flag of an item as a droppable item or an undroppable item.



Remarks

Useful function. For instance, if you have a bunch of enemies with a certain item, and you only want some of them to drop that, but want it determined randomly, you can call SetDroppableFlag either OnSpawn or OnDeath of those creatures with a randomness factor determining if the item should be droppable or not.


Version

1.30

Example

//A bunch of creatures have items tagged "some_boots". You
//want, statistically, 25% of them to drop those boots
//when slain. Goes either OnDeath or OnSpawn

void main()
{
object oItem=GetItemPossessedBy(OBJECT_SELF, "some_boots");

//25% chance of being droppable
int bDroppable=d100()>75;

SetDroppableFlag(oItem, bDroppable);
}

See Also

functions: GetDroppableFlag
categories: Miscellaneous Functions


 author: Charles Feduke, editor: Lilac Soul