All monster drops specific item with blacklist mobs

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 ?

 
On phone but this should do it

Code:
-	script	dropnpc	FAKE_NPC,{
OnNPCKillEvent:
if (rand(1000) > 50) // 5%
	end;
dispbottom("Happy Halloween!");
getitem(Apple, 1);
end;
}
 
Last edited by a moderator:
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.

 
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
default_tongue.png


 
Last edited by a moderator:
Back
Top