DropItem

From ZDoom Wiki
Jump to navigation Jump to search

int DropItem (int tid, string item [, int dropamount [, int chance]])

Usage

Causes actors with the matching TID to drop the specified item. If tid is 0, the activator of the script is considered to be the dropper of the item. This works in a similar way to the DropItem actor property.

Parameters

  • tid: The TID of the actor which the item is dropped by.
  • item: The item to drop. This can be any valid actor class, not just inventory.
  • dropamount: The inventory amount the dropped item contains. This is only meaningful with actors inheriting from the Inventory class. If dropamount is greater than 0, the amount of inventory gained from picking up the item equals exactly to that number. Otherwise, the amount gotten is the same as the amount defined by the item itself, except for ammo items, which in this case, the amount is determined by the current skill level's DropAmmoFactor. Default is -1.
  • chance: The probability of the drop. The item is never dropped if this is -1 or less, while it is always dropped if this is 255 or greater. Default is 256.

Return value

Returns the total number of actors that attempted to drop the item, otherwise it returns 0. The success or failure of an item drop has no consequence on the returned value.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.


See also