All monster drops specific item with blacklist mobs

mrlongshen

Noobies
Messages
1,126
Points
0
Age
36
Location
localhost 127.0.0.1
Emulator
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

Code:
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";
 
@@mrlongshen

Code:
-	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;}
 
Last edited by a moderator:
@HD Scripts haha lol ! 
default_tongue.png


@@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..

Code:
[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)
 
Last edited by a moderator:
@@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.

 
@@mrlongshen

Try this:

Code:
-	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;}
 
@@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.

Code:
[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)
 
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?

 
@@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:

Code:
-	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;}
 
Last edited by a moderator:
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.

 
@@Garr

I see, thanks for clarifying things. That will make it easier for me in the future.

@@mrlongshen

I updated the last post, test if it works with that script.

 
@@Winterfox

Code:
[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)
 
@@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.

 
@@mrlongshen

So you removed it from the npc i posted? Of course it can't work then.

You should add atleast that:

Code:
.blacklist$ = getvariableofnpc( .blacklist$, "HUNTINGMISSIONNPCNAME");
 
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

 
Last edited by a moderator:
Back
Top