DropItem

From ZDoom Wiki
Jump to: navigation, 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. This ranges from 0 as being "never drop" to 256 as being "always drop". Default is 256.

Return value

The function returns zero if item is null. If it is not null, however, then the return value is the total number of successful drop call iterations made on the affected actors.

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 contibutions are greatly appreciated.


See also