Blazing Spear Posted February 23, 2013 Group: Members Topic Count: 58 Topics Per Day: 0.01 Content Count: 208 Reputation: 1 Joined: 01/06/12 Last Seen: July 2, 2016 Share Posted February 23, 2013 how to make script like this? 1 monster = 1-10 item random thanks! Quote Link to comment Share on other sites More sharing options...
Emistry Posted February 23, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: 10 hours ago Share 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 Link to comment Share on other sites More sharing options...
Blazing Spear Posted February 23, 2013 Group: Members Topic Count: 58 Topics Per Day: 0.01 Content Count: 208 Reputation: 1 Joined: 01/06/12 Last Seen: July 2, 2016 Author Share 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 Link to comment Share on other sites More sharing options...
Bahmut Posted February 23, 2013 Group: Members Topic Count: 17 Topics Per Day: 0.00 Content Count: 382 Reputation: 39 Joined: 01/17/12 Last Seen: February 13, 2020 Share 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 Link to comment Share on other sites More sharing options...
HollyEnix Posted February 23, 2013 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 9 Reputation: 4 Joined: 12/15/11 Last Seen: April 8, 2019 Share 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 Link to comment Share on other sites More sharing options...
Blazing Spear Posted February 23, 2013 Group: Members Topic Count: 58 Topics Per Day: 0.01 Content Count: 208 Reputation: 1 Joined: 01/06/12 Last Seen: July 2, 2016 Author Share 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 Link to comment Share on other sites More sharing options...
Capuche Posted February 23, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share 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 Link to comment Share on other sites More sharing options...
Blazing Spear Posted February 24, 2013 Group: Members Topic Count: 58 Topics Per Day: 0.01 Content Count: 208 Reputation: 1 Joined: 01/06/12 Last Seen: July 2, 2016 Author Share 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 Link to comment Share on other sites More sharing options...
Bahmut Posted February 24, 2013 Group: Members Topic Count: 17 Topics Per Day: 0.00 Content Count: 382 Reputation: 39 Joined: 01/17/12 Last Seen: February 13, 2020 Share 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 Link to comment Share on other sites More sharing options...
HollyEnix Posted February 28, 2013 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 9 Reputation: 4 Joined: 12/15/11 Last Seen: April 8, 2019 Share 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 Link to comment Share on other sites More sharing options...
Question
Blazing Spear
how to make script like this?
1 monster = 1-10 item random
thanks!
Link to comment
Share on other sites
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.