Jump to content
  • 0

Killing Monster Recieved Item Per Rate


Question

Posted

Is it possible to make a script with the following conditions?

if kill this monster ID 1893

-Poring Coin Drop 80%

-Potion Drop 100%

-Custom Box 1 10%

-Custom Box 2 10%

-Custom Box 3 30%

 

6 answers to this question

Recommended Posts

Posted (edited)

I don't see why not.
 

-	script	Drop Emulator	-1,{
OnNPCKillEvent:
	set .@mid, killedrid;
	set .@ar$, ".mob"+.@mid;
	set .@len, getarraysize(getd(.@ar$));
	if(.@len){
		for(set .@p,1; .@p<.@len;set .@p,.@p+2 ) {
			set .@itm, getd(.@ar$+"["+(.@p-1)+"]");
			set @itmtyp, getiteminfo(.@itm,2);
			set .@btflg, callfunc("Monster_DB",.@mid);
			set .@itmrt, getd(.@ar$+"["+.@p+"]");
			query_sql("SELECT ROUND("+.@itmrt+"*("+.@btflg+"/100));",.@rte);
			if(((.@rte<=10000)?((rand(1,10000/.@rte)==1)?1:0):1)) {
				getitem .@itm,1;
			}
		}
	}
	end;
	
OnInit: //By Skorm
	//Example Poring Apple, 10%, Apple, 1.5%....etc
	setarray .mob1893, 7539, 8000, 512, 150, 619, 20, 713, 1500, 909, 7000, 938, 400, 1202, 100, 4001, 1; // Mob List 10000=100% can support up to 128 values
}

function	script	Monster_DB	{
	switch(getarg(0)){
		case 1893:
			switch(@itmtyp){
				// Keep in mind these are precents overall so 20% is actually lower while 140% is actually 40% higher.
				// Where 200% is double... It's like saying 2*400=800.
				case 0: // Heal Item Rate (Healing Items)
					return 100; // 100% for  healing items.
				
				case 2: case 7: case 11: case 18: // Uasable Item Rate (Anything Usable that doesn't heal)
					return 100; // 100% for healing items.
					
				case 3: // Common Item Rate (ETC)
					return 100; //100% more for Common Items.
				
				case 4: case 5: case 8: case 10: // Equip Item Rate (Ammo, Pet Equip, Weapon, Armor)
					return 100; // 100% more for equip items.
				
				case 6: // Card Item Rate (Card)
					return 100; // 100% more for cards.
			}
		case 1003:
		case 1004:
		case 1005:
		//...to add new monsters simply do as I've done.
	}
}



I don't know the IDs of your potion drop or your custom box drops so you'll have to add them.
 

	//Example Poring Apple, 10%, Apple, 1.5%....etc
	setarray .mob1893, 7539, 8000, 512, 150, 619, 20, 713, 1500, 909, 7000, 938, 400, 1202, 100, 4001, 1; // Mob List 10000=100% can support up to 128 values
Edited by Skorm
Posted

I don't see why not.

 

-	script	Drop Emulator	-1,{
OnNPCKillEvent:
	set .@mid, killedrid;
	set .@ar$, ".mob"+.@mid;
	set .@len, getarraysize(getd(.@ar$));
	if(.@len){
		for(set .@p,1; .@p<.@len;set .@p,.@p+2 ) {
			set .@itm, getd(.@ar$+"["+(.@p-1)+"]");
			set @itmtyp, getiteminfo(.@itm,2);
			set .@btflg, callfunc("Monster_DB",.@mid);
			set .@itmrt, getd(.@ar$+"["+.@p+"]");
			query_sql("SELECT ROUND("+.@itmrt+"*("+.@btflg+"/100));",.@rte);
			if(((.@rte<=10000)?((rand(1,10000/.@rte)==1)?1:0):1)) {
				getitem .@itm,1;
			}
		}
	}
	end;
	
OnInit: //By Skorm
	//Example Poring Apple, 10%, Apple, 1.5%....etc
	setarray .mob1893, 7539, 8000, 512, 150, 619, 20, 713, 1500, 909, 7000, 938, 400, 1202, 100, 4001, 1; // Mob List 10000=100% can support up to 128 values
}

function	script	Monster_DB	{
	switch(getarg(0)){
		case 1893:
			switch(@itmtyp){
				// Keep in mind these are precents overall so 20% is actually lower while 140% is actually 40% higher.
				// Where 200% is double... It's like saying 2*400=800.
				case 0: // Heal Item Rate (Healing Items)
					return 100; // 100% for  healing items.
				
				case 2: case 7: case 11: case 18: // Uasable Item Rate (Anything Usable that doesn't heal)
					return 100; // 100% for healing items.
					
				case 3: // Common Item Rate (ETC)
					return 100; //100% more for Common Items.
				
				case 4: case 5: case 8: case 10: // Equip Item Rate (Ammo, Pet Equip, Weapon, Armor)
					return 100; // 100% more for equip items.
				
				case 6: // Card Item Rate (Card)
					return 100; // 100% more for cards.
			}
		case 1003:
		case 1004:
		case 1005:
		//...to add new monsters simply do as I've done.
	}
}

I don't know the IDs of your potion drop or your custom box drops so you'll have to add them.

 

	//Example Poring Apple, 10%, Apple, 1.5%....etc
	setarray .mob1893, 7539, 8000, 512, 150, 619, 20, 713, 1500, 909, 7000, 938, 400, 1202, 100, 4001, 1; // Mob List 10000=100% can support up to 128 values

Well Done Skorm. a True Professional.... I admire your talent /OTL 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...