<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.herc.ws/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.herc.ws/w/index.php?action=history&amp;feed=atom&amp;title=Getmobdrops</id>
		<title>Getmobdrops - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.herc.ws/w/index.php?action=history&amp;feed=atom&amp;title=Getmobdrops"/>
		<link rel="alternate" type="text/html" href="https://wiki.herc.ws/w/index.php?title=Getmobdrops&amp;action=history"/>
		<updated>2026-05-02T09:52:12Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.21.11</generator>

	<entry>
		<id>https://wiki.herc.ws/w/index.php?title=Getmobdrops&amp;diff=844&amp;oldid=prev</id>
		<title>Sevenzz23: Created page with &quot;== Syntax == * getmobdrops (&lt;mob id&gt;);  == Description == &lt;p&gt;This command will find all drops of the specified mob and return the item  IDs and drop percentages into array...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.herc.ws/w/index.php?title=Getmobdrops&amp;diff=844&amp;oldid=prev"/>
				<updated>2014-01-20T14:08:00Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Syntax == * &lt;a href=&quot;/wiki/Getmobdrops&quot; title=&quot;Getmobdrops&quot;&gt;getmobdrops&lt;/a&gt; (&amp;lt;mob id&amp;gt;);  == Description == &amp;lt;p&amp;gt;This command will find all drops of the specified mob and return the item  IDs and drop percentages into array...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Syntax ==&lt;br /&gt;
* [[getmobdrops]] (&amp;lt;mob id&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&amp;lt;p&amp;gt;This command will find all drops of the specified mob and return the item &lt;br /&gt;
IDs and drop percentages into arrays of temporary global variables. &lt;br /&gt;
'getmobdrops' returns 1 if successful and 0 if the mob ID doesn't exist.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon executing this,&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Array&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| '''$@MobDrop_item[]''' || is a global temporary number array which contains the item IDs of the monster's drops.&lt;br /&gt;
|-&lt;br /&gt;
| '''$@MobDrop_rate[]''' || is a global temporary number array which contains the drop percentages of each item. (1 = .01%)&lt;br /&gt;
|-&lt;br /&gt;
| '''$@MobDrop_count''' || is the number of item drops found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Be sure to use '''$@MobDrop_count''' to go through the arrays, and not [[getarraysize]], because the temporary global arrays are not cleared between runs of [[getmobdrops]]. If a mob with 7 item drops is looked up, &lt;br /&gt;
the arrays would have 7 elements. But if another mob is looked up and it only has 5 item drops, the server will not clear the arrays for you, overwriting the values instead. So in addition to returning the 5 item drops, the 6th and 7th elements from the last call remain, and you will get 5+2 item drops, of which the last 2 don't belong to the new mob. &lt;br /&gt;
'''$@MobDrop_count''' will always contain the correct number (5), unlike &lt;br /&gt;
[[getarraysize]] which would return 7 in this case.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
 	// get a Mob ID from the user&lt;br /&gt;
 	input .@mob_id;&lt;br /&gt;
 	&lt;br /&gt;
 	if (getmobdrops(.@mob_id)) {	// 'getmobdrops' returns 1 on success&lt;br /&gt;
 		// immediately copy global temporary variables into scope &lt;br /&gt;
 		// variables, since we don't know when 'getmobdrops' will get &lt;br /&gt;
 		// called again for another mob, overwriting your global temporary &lt;br /&gt;
 		// variables.&lt;br /&gt;
 		set .@count, $@MobDrop_count;&lt;br /&gt;
 		copyarray .@item[0],$@MobDrop_item[0],.@count;&lt;br /&gt;
 		copyarray .@rate[0],$@MobDrop_rate[0],.@count;&lt;br /&gt;
 		&lt;br /&gt;
 		mes getmonsterinfo(.@mob_id,MOB_NAME) + &amp;quot; - &amp;quot; + .@count + &amp;quot; drops found:&amp;quot;;&lt;br /&gt;
 		for( set .@i,0; .@i &amp;lt; .@count; set .@i,.@i +1 ) {&lt;br /&gt;
 			mes .@item[.@i] + &amp;quot; (&amp;quot; + getitemname(.@item[.@i]) + &amp;quot;) &amp;quot; &lt;br /&gt;
 			+ .@rate[.@i]/100 + ((.@rate[.@i]%100 &amp;lt; 10) ? &amp;quot;.0&amp;quot;:&amp;quot;.&amp;quot;) + .@rate[.@i]%100 + &amp;quot;%&amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 	} else {&lt;br /&gt;
 		mes &amp;quot;Unknown monster ID.&amp;quot;;&lt;br /&gt;
 	}&lt;br /&gt;
 	close;&lt;br /&gt;
&lt;br /&gt;
[[Category:Script Command]]&lt;/div&gt;</summary>
		<author><name>Sevenzz23</name></author>	</entry>

	</feed>