Item drops: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Heeheehee
m Linkage!
imported>AlbinoRhino
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 6: Line 6:
FunctionPage|
FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Item Management|


function1={{Function|
function1={{Function|
Line 40: Line 39:
}}|
}}|


see_also={{SeeAlso|meat_drop|item_drop_modifier}}|
see_also={{SeeAlso|meat_drop|item_drop_modifier|item_drops_array}}|
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|item_drops_array()]] can be used to bypass this limitation.
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, however [[item_drops_array|item_drops_array()]] can be used to bypass this limitation.
}}
}}
[[Category:Item Management]]

Latest revision as of 22:39, 24 May 2017

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

meat_drop() | item_drop_modifier() | item_drops_array()

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, however item_drops_array() can be used to bypass this limitation.