Jump to content
  • 0
Sign in to follow this  
mrlongshen

All monster drops specific item with blacklist mobs

Question

Hi all.

I want to request simple script.

Here the explanation.

 

All mobs in ragnarok in all maps are drops specific item. E.g: Poring coin (7539), TCG Card (7227) when killed. 

I can add blacklist monster that I don't want to player kill it and get the coins. E.g:See below post

set .Blacklist$,	// Blacklisted mob IDs.		"1062,1088,1183,1186,1200,1212,1220,1221,1234,1235,"+		"1244,1245,1250,1268,1290,1293,1294,1296,1298,1299,"+		"1300,1301,1303,1304,1305,1306,1308,1309,1311,1313,"+		"1515,1588,1618,1676,1677,1678,1679,1796,1797,1974,"+		"1975,1976,1977,1978,1979";

 

Share this post


Link to post
Share on other sites

24 answers to this question

Recommended Posts

  • 0

@@mrlongshen

 

-	script	GLOBAL_LOOT	-1,{	OnInit:		// Config //		// ItemID, Rate ( [1:10000], Example: 1000 = 0,1%, 100 = 1%... )		setarray .drops, Poring_Coin, 100						, TCG_Card, 100;			.blacklist$ = "1062,1088,1183,1186,1200,1212,1220,1221,1234,1235,"					+ "1244,1245,1250,1268,1290,1293,1294,1296,1298,1299,"					+ "1300,1301,1303,1304,1305,1306,1308,1309,1311,1313,"					+ "1515,1588,1618,1676,1677,1678,1679,1796,1797,1974,"					+ "1975,1976,1977,1978,1979";			.dropCount = getarraysize(.@drops);		// Main Code		while( sleep( 500 ) ) {			.@rc = query_sql("SELECT ID FROM `mob_db` WHERE ID NOT IN( " + .blacklist$ + " ) LIMIT " + .@currentOffset + ", 128", .@MobIds );						for( .@i = 0; .@i < .@rc; .@i++ ) {				for( .@y = 0; .@y < .dropCount; .@y += 2 )					addmonsterdrop( .@MobIds[.@i], .drops[.@y], .drops[(.@y + 1)] );			}			if( .@rc < 128 ) break;					.@currentOffset += .@rc;		}	end;}
Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0

@HD Scripts haha lol !  :P



@@Winterfox thanks.

 

how the rate working ?

// ItemID, Rate ( [1:10000], Example: 1000 = 0,1%, 100 = 1%... )

 

If i set 10000 means 0.0001% ?

 

The item not drops.

I got this warning..

 

[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=693[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=693[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=693[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=693[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=693[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=693[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=693[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=693[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=693[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=693[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=693[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)
Edited by mrlongshen

Share this post


Link to post
Share on other sites
  • 0

@@mrlongshen

 

1000 = 0.1%, so 10000 = 0.01%.

 

Did you make changes to the script or did you run it in it's current form? If you changed something please post it.

 

no. i use script that you give to me only.

Share this post


Link to post
Share on other sites
  • 0

@@mrlongshen

 

Try this:

-	script	GLOBAL_LOOT	-1,{	OnInit:		// Config //		// ItemID, Rate ( [1:10000], Example: 1000 = 0,1%, 100 = 1%... )		setarray .drops, 7539, 100, 7227, 100;			.blacklist$ = "1062,1088,1183,1186,1200,1212,1220,1221,1234,1235,"					+ "1244,1245,1250,1268,1290,1293,1294,1296,1298,1299,"					+ "1300,1301,1303,1304,1305,1306,1308,1309,1311,1313,"					+ "1515,1588,1618,1676,1677,1678,1679,1796,1797,1974,"					+ "1975,1976,1977,1978,1979";			.dropCount = getarraysize(.@drops);		// Main Code		while( sleep( 1 ) ) {			cleararray .@mobIds[0], 0, 128;			.@rc = query_sql("SELECT ID FROM `mob_db` WHERE ID NOT IN( " + .blacklist$ + " ) LIMIT " + .@currentOffset + ", 128", .@mobIds);						for(.@i = 0; .@i < .@rc; .@i++) {				for(.@y = 0; .@y < .dropCount; .@y += 2)					addmonsterdrop(.@mobIds[.@i], .drops[.@y], .drops[(.@y + 1)]);			}			if( .@rc < 128 ) break;					.@currentOffset += .@rc;		}	end;}

Share this post


Link to post
Share on other sites
  • 0

 

@@mrlongshen

 

Try this:

-	script	GLOBAL_LOOT	-1,{	OnInit:		// Config //		// ItemID, Rate ( [1:10000], Example: 1000 = 0,1%, 100 = 1%... )		setarray .drops, 7539, 100, 7227, 100;			.blacklist$ = "1062,1088,1183,1186,1200,1212,1220,1221,1234,1235,"					+ "1244,1245,1250,1268,1290,1293,1294,1296,1298,1299,"					+ "1300,1301,1303,1304,1305,1306,1308,1309,1311,1313,"					+ "1515,1588,1618,1676,1677,1678,1679,1796,1797,1974,"					+ "1975,1976,1977,1978,1979";			.dropCount = getarraysize(.@drops);		// Main Code		while( sleep( 1 ) ) {			cleararray .@mobIds[0], 0, 128;			.@rc = query_sql("SELECT ID FROM `mob_db` WHERE ID NOT IN( " + .blacklist$ + " ) LIMIT " + .@currentOffset + ", 128", .@mobIds);						for(.@i = 0; .@i < .@rc; .@i++) {				for(.@y = 0; .@y < .dropCount; .@y += 2)					addmonsterdrop(.@mobIds[.@i], .drops[.@y], .drops[(.@y + 1)]);			}			if( .@rc < 128 ) break;					.@currentOffset += .@rc;		}	end;}

 

same problem occurs.

 

[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=709[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=709[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=709[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=709[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=709[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=709[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=709[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=709[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=709[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=709[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)[Warning]: Unexpected type for argument 1. Expected number.[Debug]: Data: label pos=709[Debug]: Function: __jump_zero[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)

Share this post


Link to post
Share on other sites
  • 0

I don't think sleep returns anything, so your while statement doesn't get anything to evaluate. Just change it to while(1) and place sleep in the end of cycle?

Share this post


Link to post
Share on other sites
  • 0

@@Garr

 

I used sleep in loops, but i am not sure if it was sleep or sleep2 and it worked.

Might it be possible that sleep2 returns something while sleep doesn't?

 

@@mrlongshen

 

Try this change please:

-	script	GLOBAL_LOOT	-1,{	OnInit:		// Config //		// ItemID, Rate ( [1:10000], Example: 1000 = 0,1%, 100 = 1%... )		setarray .drops, 7539, 100, 7227, 100;			.blacklist$ = "1062,1088,1183,1186,1200,1212,1220,1221,1234,1235,"					+ "1244,1245,1250,1268,1290,1293,1294,1296,1298,1299,"					+ "1300,1301,1303,1304,1305,1306,1308,1309,1311,1313,"					+ "1515,1588,1618,1676,1677,1678,1679,1796,1797,1974,"					+ "1975,1976,1977,1978,1979";			.dropCount = getarraysize(.@drops);		// Main Code		while( 1 ) {			cleararray .@mobIds[0], 0, 128;			.@rc = query_sql("SELECT ID FROM `mob_db` WHERE ID NOT IN( " + .blacklist$ + " ) LIMIT " + .@currentOffset + ", 128", .@mobIds);						for(.@i = 0; .@i < .@rc; .@i++) {				for(.@y = 0; .@y < .dropCount; .@y += 2)					addmonsterdrop(.@mobIds[.@i], .drops[.@y], .drops[(.@y + 1)]);			}			if( .@rc < 128 ) break;					.@currentOffset += .@rc;                        sleep(1);		}	end;}
Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0

Yup, sleep2 returns a bool if the player is still attached. The problem is, in this case as there would be no player attached it'll return 0 and it won't even run the cycle.

Share this post


Link to post
Share on other sites
  • 0

@@Winterfox

 

[SQL]: DB error - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 0, 128' at line 1[Debug]: at d:4. world of ragnarokporn ro 2015herculessrcmapscript.c:15653 - SELECT ID FROM `mob_db` WHERE ID NOT IN(  ) LIMIT 0, 128[Debug]: Source (NPC): GLOBAL_LOOT (invisible/not on a map)

Share this post


Link to post
Share on other sites
  • 0

@@mrlongshen

 

Did you use the exact script i posted or did you change something to it? Maybe renamed .blacklist$ or made it empty or something?

The problem occurs since your .blacklist$ variable seems to be empty for some reason.

Share this post


Link to post
Share on other sites
  • 0

simple script

-	script	kdjsfhksdjfh	FAKE_NPC,{OnInit:	setarray .itemid, Poring_Coin, TCG_Card;	setarray .rate, 10000, 10000;	.blacklist$ = "1062,1088,1183,1186,1200,1212,1220,1221,1234,1235,"		+ "1244,1245,1250,1268,1290,1293,1294,1296,1298,1299,"		+ "1300,1301,1303,1304,1305,1306,1308,1309,1311,1313,"		+ "1515,1588,1618,1676,1677,1678,1679,1796,1797,1974,"		+ "1975,1976,1977,1978,1979";	.size = getarraysize(.itemid);	freeloop true;	for ( .@id = 1001; .@id <= 5000; .@id++ ) // 5000 is MAX_MOB_DB from srcmapmob.h		if ( strmobinfo( 3, .@id ) && !compare( ","+ .blacklist$ +",", ","+ .@id +"," ) )			for ( .@i = 0; .@i < .size; .@i++ )				addmonsterdrop( .@id, .itemid[.@i], .rate[.@i] );	end;}
.

.

.

@@Winterfox

there is no need to use query_sql for this operation

just a *compare command will do

 

 

EDITING for dynamic item ID and random rate

done

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

Anni

 

 

simple script

-	script	kdjsfhksdjfh	FAKE_NPC,{OnInit:	setarray .itemid, Poring_Coin, TCG_Card;	setarray .rate, 10000, 10000;	.blacklist$ = "1062,1088,1183,1186,1200,1212,1220,1221,1234,1235,"		+ "1244,1245,1250,1268,1290,1293,1294,1296,1298,1299,"		+ "1300,1301,1303,1304,1305,1306,1308,1309,1311,1313,"		+ "1515,1588,1618,1676,1677,1678,1679,1796,1797,1974,"		+ "1975,1976,1977,1978,1979";	.size = getarraysize(.itemid);	freeloop true;	for ( .@id = 1001; .@id <= 5000; .@id++ ) // 5000 is MAX_MOB_DB from srcmapmob.h		if ( strmobinfo( 3, .@id ) && !compare( ","+ .blacklist$ +",", ","+ .@id +"," ) )			for ( .@i = 0; .@i < .size; .@i++ )				addmonsterdrop( .@id, .itemid[.@i], .rate[.@i] );	end;}
.
.
.
@@Winterfox
there is no need to use query_sql for this operation
just a *compare command will do


EDITING for dynamic item ID and random rate
done

 

How to make the drop item directly into player inventory ?

Share this post


Link to post
Share on other sites
  • 0

On phone but this should do it

 

-	script	dropnpc	FAKE_NPC,{
OnNPCKillEvent:
if (rand(1000) > 50) // 5%
	end;
dispbottom("Happy Halloween!");
getitem(Apple, 1);
end;
}

Share this post


Link to post
Share on other sites
  • 0

 

On phone but this should do it

-	script	dropnpc	FAKE_NPC,{
OnNPCKillEvent:
if (rand(1000) > 50) // 5%
end;
dispbottom("Happy Halloween!");
getitem(Apple, 1);
end;
}

 

Thanks. Its work. 

Buy I want add  many item in  there.

Like 4 item i set, then random item will give.

Example Apple, Oren juice, banana juice and watermelon juice.

So when I kill monster I will get random of this item.

Share this post


Link to post
Share on other sites
  • 0

 

 

On phone but this should do it

-	script	dropnpc	FAKE_NPC,{
OnNPCKillEvent:
if (rand(1000) > 50) // 5%
end;
dispbottom("Happy Halloween!");
getitem(Apple, 1);
end;
}

 

Thanks. Its work. 

Buy I want add  many item in  there.

Like 4 item i set, then random item will give.

Example Apple, Oren juice, banana juice and watermelon juice.

So when I kill monster I will get random of this item.

 

 

you can use f_rand function

 

-	script	dropnpc	FAKE_NPC,{
OnNPCKillEvent:
if (rand(1000) > 50) // 5%
	end;
dispbottom("Happy Halloween!");
getitem(callfunc("F_Rand", Apple, Banana, Red_Potion, Orange_Potion), 1);
end;
}

 

edit: asheraf was faster :P

Share this post


Link to post
Share on other sites

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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.