Item drops: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle mNo edit summary |
imported>Heeheehee mNo edit summary |
||
Line 1: | Line 1: | ||
{{#vardefine:name|item_drops}} | {{ | ||
{{#vardefine:return_type|int [item]}} | #vardefine:name|item_drops}}{{ | ||
{{#vardefine:aggregate|yes}} | #vardefine:return_type|int [item]}}{{ | ||
#vardefine:aggregate|yes}}{{ | |||
FunctionPage| | |||
name={{#var:name}}| | name={{#var:name}}| | ||
function_category=Item Management| | function_category=Item Management| | ||
function1={{Function| | function1={{Function| | ||
name={{#var:name}}| | |||
aggregate={{#var:aggregate}}| | |||
return_type={{#var:return_type}}| | |||
return_also={{#var:return_also}} | |||
}}| | |||
function2={{Function| | |||
name={{#var:name}}| | name={{#var:name}}| | ||
aggregate={{#var:aggregate}}| | aggregate={{#var:aggregate}}| | ||
Line 32: | Line 41: | ||
see_also={{SeeAlso|meat_drop|item_drop_modifier()}}| | see_also={{SeeAlso|meat_drop|item_drop_modifier()}}| | ||
special=This function has a known | special=This function has a known limitation: if a monster drops the same item more than once, the map only returns the last rate in that monster's entry in monsters.txt. As of revision 8356, however, item_drops_array() can be used to bypass this limitation. | ||
}} | }} |
Revision as of 07:20, 5 April 2010
Function Syntax
int [item] item_drops()
int [item] item_drops(monster m )
Returns a map of the monster's drop rates, indexed by item names.
Code Samples
Prints the drops of a certain monster.
void drops(monster mob){
int[item] drops = item_drops(mob);
print("Monster: " + mob);
foreach i in drops {
print("Drop rate of " + i + " is " + drops[i]*(1+item_drop_modifier()/100) + "%");
}
}
See Also
Special
This function has a known limitation: if a monster drops the same item more than once, the map only returns the last rate in that monster's entry in monsters.txt. As of revision 8356, however, item_drops_array() can be used to bypass this limitation.