Erio-chan Posted August 2, 2017 Group: Members Topic Count: 35 Topics Per Day: 0.01 Content Count: 97 Reputation: 10 Joined: 07/23/16 Last Seen: August 31, 2018 Share Posted August 2, 2017 This script will drop 1 item from your Inventory when die. I want to input list of Item that not affected by this script. - script nightmaremode -1,{ OnPCDieEvent: if (countitem(7773) >= 1) end; if (BaseLevel < 40) end; //if ( strcharinfo(3) != "moc_fild12" ) end; // set your map //if ( pkpoints < 100 ) end; // decide on the pk points getinventorylist; if ( !@inventorylist_count ) end; .@r = rand( @inventorylist_count ); delitem2 @inventorylist_id[.@r], @inventorylist_amount[.@r], @inventorylist_identify[.@r], @inventorylist_refine[.@r], @inventorylist_attribute[.@r], @inventorylist_card1[.@r], @inventorylist_card2[.@r], @inventorylist_card3[.@r], @inventorylist_card4[.@r]; getmapxy .@map$, .@x, .@y, 0; makeitem2 @inventorylist_id[.@r], @inventorylist_amount[.@r], .@map$, .@x, .@y, @inventorylist_identify[.@r], @inventorylist_refine[.@r], @inventorylist_attribute[.@r], @inventorylist_card1[.@r], @inventorylist_card2[.@r], @inventorylist_card3[.@r], @inventorylist_card4[.@r]; end; } Quote Link to comment Share on other sites More sharing options...
1 Emistry Posted August 3, 2017 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted August 3, 2017 @Technoken because script will stop the script when detected blacklist items, hence the player will not drop anything even if they have other non-blacklisted items with them. @Erio-chan you can try this. Not the ideal way, but should be workable. - script nightmaremode -1,{ OnInit: .blacklist$ = "501,502,503,504,505"; end; OnPCDieEvent: if (countitem(7773) >= 1) end; if (BaseLevel < 40) end; //if ( strcharinfo(3) != "moc_fild12" ) end; // set your map //if ( pkpoints < 100 ) end; // decide on the pk points getinventorylist; .@size = (@inventorylist_count-1); for ( .@i = .@size; .@i >= 0; .@i--) { if (compare(","+.blacklist$+",", ","+@inventorylist_id[.@i]+",")) { deletearray @inventorylist_id[.@i],1; deletearray @inventorylist_amount[.@i],1; deletearray @inventorylist_identify[.@i],1; deletearray @inventorylist_refine[.@i],1; deletearray @inventorylist_attribute[.@i],1; deletearray @inventorylist_card1[.@i],1; deletearray @inventorylist_card2[.@i],1; deletearray @inventorylist_card3[.@i],1; deletearray @inventorylist_card4[.@i],1; .@size--; } } if (.@size > 0) { .@r = rand(.@size); delitem2 @inventorylist_id[.@r], @inventorylist_amount[.@r], @inventorylist_identify[.@r], @inventorylist_refine[.@r], @inventorylist_attribute[.@r], @inventorylist_card1[.@r], @inventorylist_card2[.@r], @inventorylist_card3[.@r], @inventorylist_card4[.@r]; getmapxy .@map$, .@x, .@y, 0; makeitem2 @inventorylist_id[.@r], @inventorylist_amount[.@r], .@map$, .@x, .@y, @inventorylist_identify[.@r], @inventorylist_refine[.@r], @inventorylist_attribute[.@r], @inventorylist_card1[.@r], @inventorylist_card2[.@r], @inventorylist_card3[.@r], @inventorylist_card4[.@r]; } end; } 1 Quote Link to comment Share on other sites More sharing options...
1 Technoken Posted August 2, 2017 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 505 Reputation: 127 Joined: 04/04/16 Last Seen: April 13 Share Posted August 2, 2017 Try this one. I didn't test it though - script nightmaremode -1,{ OnPCDieEvent: if (countitem(7773) >= 1) end; if (BaseLevel < 40) end; //if ( strcharinfo(3) != "moc_fild12" ) end; // set your map //if ( pkpoints < 100 ) end; // decide on the pk points getinventorylist; if ( !@inventorylist_count ) end; .@r = rand( @inventorylist_count ); for( .@i = 0; .@i < .size; .@i++ ) { if( @inventorylist_id[.@r] == .Blacklist[.@i] ) end; } delitem2 @inventorylist_id[.@r], @inventorylist_amount[.@r], @inventorylist_identify[.@r], @inventorylist_refine[.@r], @inventorylist_attribute[.@r], @inventorylist_card1[.@r], @inventorylist_card2[.@r], @inventorylist_card3[.@r], @inventorylist_card4[.@r]; getmapxy .@map$, .@x, .@y, 0; makeitem2 @inventorylist_id[.@r], @inventorylist_amount[.@r], .@map$, .@x, .@y, @inventorylist_identify[.@r], @inventorylist_refine[.@r], @inventorylist_attribute[.@r], @inventorylist_card1[.@r], @inventorylist_card2[.@r], @inventorylist_card3[.@r], @inventorylist_card4[.@r]; end; OnInit: setarray .Blacklist, 5112,5113,5114; // ID's that are not affected by the script .size = getarraysize(.Blacklist); end; } 1 Quote Link to comment Share on other sites More sharing options...
0 Erio-chan Posted August 2, 2017 Group: Members Topic Count: 35 Topics Per Day: 0.01 Content Count: 97 Reputation: 10 Joined: 07/23/16 Last Seen: August 31, 2018 Author Share Posted August 2, 2017 5 hours ago, Technoken said: Try this one. I didn't test it though - script nightmaremode -1,{ OnPCDieEvent: if (countitem(7773) >= 1) end; if (BaseLevel < 40) end; //if ( strcharinfo(3) != "moc_fild12" ) end; // set your map //if ( pkpoints < 100 ) end; // decide on the pk points getinventorylist; if ( !@inventorylist_count ) end; .@r = rand( @inventorylist_count ); for( .@i = 0; .@i < .size; .@i++ ) { if( @inventorylist_id[.@r] == .Blacklist[.@i] ) end; } delitem2 @inventorylist_id[.@r], @inventorylist_amount[.@r], @inventorylist_identify[.@r], @inventorylist_refine[.@r], @inventorylist_attribute[.@r], @inventorylist_card1[.@r], @inventorylist_card2[.@r], @inventorylist_card3[.@r], @inventorylist_card4[.@r]; getmapxy .@map$, .@x, .@y, 0; makeitem2 @inventorylist_id[.@r], @inventorylist_amount[.@r], .@map$, .@x, .@y, @inventorylist_identify[.@r], @inventorylist_refine[.@r], @inventorylist_attribute[.@r], @inventorylist_card1[.@r], @inventorylist_card2[.@r], @inventorylist_card3[.@r], @inventorylist_card4[.@r]; end; OnInit: setarray .Blacklist, 5112,5113,5114; // ID's that are not affected by the script .size = getarraysize(.Blacklist); end; } Thank you very much for your script it works. It's really a BIG Help for me, I appreciate it. but the side effect is when you got many blacklist item is decreasing the percentage of dropping Item. all in all good job Quote Link to comment Share on other sites More sharing options...
0 Technoken Posted August 2, 2017 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 505 Reputation: 127 Joined: 04/04/16 Last Seen: April 13 Share Posted August 2, 2017 4 hours ago, Erio-chan said: Thank you very much for your script it works. It's really a BIG Help for me, I appreciate it. but the side effect is when you got many blacklist item is decreasing the percentage of dropping Item. all in all good job I don't see anything that will decrease the percentage of dropping an item. for( .@i = 0; .@i < .size; .@i++ ) { if( @inventorylist_id[.@r] == .Blacklist[.@i] ) end; } ^ this part will only check if the random item picked from inventory is in the .Blacklist. Quote Link to comment Share on other sites More sharing options...
0 Technoken Posted August 3, 2017 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 505 Reputation: 127 Joined: 04/04/16 Last Seen: April 13 Share Posted August 3, 2017 @Emistry Lol yeah. What I thought is it would only run once and stop if the random item selected was in the blacklist. Quote Link to comment Share on other sites More sharing options...
0 Erio-chan Posted August 3, 2017 Group: Members Topic Count: 35 Topics Per Day: 0.01 Content Count: 97 Reputation: 10 Joined: 07/23/16 Last Seen: August 31, 2018 Author Share Posted August 3, 2017 15 hours ago, Emistry said: @Technoken because script will stop the script when detected blacklist items, hence the player will not drop anything even if they have other non-blacklisted items with them. @Erio-chan you can try this. Not the ideal way, but should be workable. - script nightmaremode -1,{ OnInit: .blacklist$ = "501,502,503,504,505"; end; OnPCDieEvent: if (countitem(7773) >= 1) end; if (BaseLevel < 40) end; //if ( strcharinfo(3) != "moc_fild12" ) end; // set your map //if ( pkpoints < 100 ) end; // decide on the pk points getinventorylist; .@size = (@inventorylist_count-1); for ( .@i = .@size; .@i >= 0; .@i--) { if (compare(","+.blacklist$+",", ","+@inventorylist_id[.@i]+",")) { deletearray @inventorylist_id[.@i],1; deletearray @inventorylist_amount[.@i],1; deletearray @inventorylist_identify[.@i],1; deletearray @inventorylist_refine[.@i],1; deletearray @inventorylist_attribute[.@i],1; deletearray @inventorylist_card1[.@i],1; deletearray @inventorylist_card2[.@i],1; deletearray @inventorylist_card3[.@i],1; deletearray @inventorylist_card4[.@i],1; .@size--; } } if (.@size > 0) { .@r = rand(.@size); delitem2 @inventorylist_id[.@r], @inventorylist_amount[.@r], @inventorylist_identify[.@r], @inventorylist_refine[.@r], @inventorylist_attribute[.@r], @inventorylist_card1[.@r], @inventorylist_card2[.@r], @inventorylist_card3[.@r], @inventorylist_card4[.@r]; getmapxy .@map$, .@x, .@y, 0; makeitem2 @inventorylist_id[.@r], @inventorylist_amount[.@r], .@map$, .@x, .@y, @inventorylist_identify[.@r], @inventorylist_refine[.@r], @inventorylist_attribute[.@r], @inventorylist_card1[.@r], @inventorylist_card2[.@r], @inventorylist_card3[.@r], @inventorylist_card4[.@r]; } end; } Thank you @Emistry its PERFECT!!! I love it! Quote Link to comment Share on other sites More sharing options...
0 Z3R0 Posted August 3, 2017 Group: Members Topic Count: 39 Topics Per Day: 0.01 Content Count: 618 Reputation: 201 Joined: 11/09/11 Last Seen: June 14, 2024 Share Posted August 3, 2017 Hmmm I like that compare feature... implode an array with commas... and prefix string with starting and ending commas... check against ,#, smart move... Quote Link to comment Share on other sites More sharing options...
Question
Erio-chan
This script will drop 1 item from your Inventory when die.
I want to input list of Item that not affected by this script.
- script nightmaremode -1,{ OnPCDieEvent: if (countitem(7773) >= 1) end; if (BaseLevel < 40) end; //if ( strcharinfo(3) != "moc_fild12" ) end; // set your map //if ( pkpoints < 100 ) end; // decide on the pk points getinventorylist; if ( !@inventorylist_count ) end; .@r = rand( @inventorylist_count ); delitem2 @inventorylist_id[.@r], @inventorylist_amount[.@r], @inventorylist_identify[.@r], @inventorylist_refine[.@r], @inventorylist_attribute[.@r], @inventorylist_card1[.@r], @inventorylist_card2[.@r], @inventorylist_card3[.@r], @inventorylist_card4[.@r]; getmapxy .@map$, .@x, .@y, 0; makeitem2 @inventorylist_id[.@r], @inventorylist_amount[.@r], .@map$, .@x, .@y, @inventorylist_identify[.@r], @inventorylist_refine[.@r], @inventorylist_attribute[.@r], @inventorylist_card1[.@r], @inventorylist_card2[.@r], @inventorylist_card3[.@r], @inventorylist_card4[.@r]; end; }
Link to comment
Share on other sites
7 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.