Blazing Spear Posted February 23, 2013 Posted February 23, 2013 how to make script like this? 1 monster = 1-10 item random thanks! Quote
Emistry Posted February 23, 2013 Posted February 23, 2013 OnNPCKillEvent: if( rand(100) < 10 ) getitem .item[ rand( .item_size ) ],1; end; OnInit: setarray .item[0],607,608,512; .item_size = getarraysize( .item ); end; edit : fixed OnPCKillEvent to OnNPCKillEvent Quote
Blazing Spear Posted February 23, 2013 Author Posted February 23, 2013 ill try this - script AllDrop -1,{ OnPCKillEvent: if( rand(100) < 10 ) getitem .item[ rand( .item_size ) ],1; end; OnInit: setarray .item[0],607,608,512; .item_size = getarraysize( .item ); end; } is this right? Quote
Bahmut Posted February 23, 2013 Posted February 23, 2013 OnPCKillEvent will only be executed when a player will kill another player so to achieve a global monster drop use OnNPCKillEvent So the script should look like this: OnNPCKillEvent: if( rand(1000) < 10 ) // Chance: 10 = 1%, 100 = 10%, etc. getitem .item[ rand( .item_size ) ],1; end; OnInit: setarray .item[0],<item id1>,<item id2>,<item id3>,<more>; .item_size = getarraysize( .item ); end; Quote
HollyEnix Posted February 23, 2013 Posted February 23, 2013 (edited) If you want the mobs to actually DROP it (on your location, probably the easiest way), use makeitem though. Be aware that autoloot won't work on it and anyone can pick it up immediately. if (getmapxy(.@map$,.@x,.@y,0,strcharinfo(0))!=1) { makeitem ID,amount,.@map$,.@x,.@y; } if it should drop a bit further from your character, you can add a number to x and y like .@x+1 or .@x+rand(2) whatever my 0.02$ :b Edited February 23, 2013 by HollyEnix 1 Quote
Blazing Spear Posted February 23, 2013 Author Posted February 23, 2013 how about random amount of item per monster?? i want 1 monster = something like 50% item then 1-10 amount Quote
Capuche Posted February 23, 2013 Posted February 23, 2013 (edited) 1/ OnNPCKillEvent: if( rand(1000) < 500 ) // Chance: 10 = 1%, 100 = 10%, etc. getitem callfunc( "F_RandMes", 5, 501,502,503,504,505 ), rand( 1,10 ); // http://rathena.org/board/topic/78263-scripting-faqtipstricks/ end; how about random amount of item per monster?? i want 1 monster = something like 50% item then 1-10 amount amount 1-10 : rand( 1,10 ); 2/ If you want the mobs to actually DROP it (on your location, probably the easiest way), use makeitem though. Be aware that autoloot won't work on it and anyone can pick it up immediately. if (getmapxy(.@map$,.@x,.@y,0,strcharinfo(0))!=1) { makeitem ID,amount,.@map$,.@x,.@y; } *getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})This function will locate a character object, NPC object or pet's coordinatesand place their coordinates into the variables specified when calling it. Itwill return 0 if the search was successful, and -1 if the parameters given werenot variables or the search was not successful. always != 1 OnNPCKillEvent: if( rand(1000) < 500 ) { // Chance: 10 = 1%, 100 = 10%, etc. getmapxy .@map$, .@x, .@y, 0; makeitem callfunc( "F_RandMes", 5, 501,502,503,504,505 ), rand( 1,10 ), .@map$, .@x, .@y; // <num item>, <item id1>,<item id2>,<item id3> } end; Edited February 23, 2013 by Capuche 1 Quote
Blazing Spear Posted February 24, 2013 Author Posted February 24, 2013 1/ OnNPCKillEvent: if( rand(1000) < 500 ) // Chance: 10 = 1%, 100 = 10%, etc. getitem callfunc( "F_RandMes", 5, 501,502,503,504,505 ), rand( 1,10 ); // http://rathena.org/board/topic/78263-scripting-faqtipstricks/ end; i tried this but this is the error Quote
Bahmut Posted February 24, 2013 Posted February 24, 2013 Have you fixed the npc header? If you paste it here it has spaces but it should have tabs. Like this: -<tab>script<tab>AllDrop<tab>-1,{ Quote
HollyEnix Posted February 28, 2013 Posted February 28, 2013 (edited) having the npc named after an event label (OnNPCKillEvent) returns your error, I believe. use another npc name, like bahmut did, and put the OnNPCKillEvent as a label within the npc don't have a server to confirm atm Edited February 28, 2013 by HollyEnix Quote
Question
Blazing Spear
how to make script like this?
1 monster = 1-10 item random
thanks!
9 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.