kayko11 Posted July 13, 2018 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 6 Reputation: 0 Joined: 10/25/17 Last Seen: August 4, 2024 Share Posted July 13, 2018 (edited) function script box____ { setarray .@reward, 14003, 100, 14003, 100, 12914, 100, 12914, 100, 12913, 100, 12913, 100, 12900, 100, 12900, 100, 13990, 100, 13990, 100, 14158, 100, 14158, 100, 12909, 100, 12909, 100, 14004, 100, 14004, 100, 12221, 100, 12221, 100, 7776, 100, 7776, 100, 12213, 15, 6320, 15, 19599, 3, 20221, 3, 19952, 3, 19664, 3, 19954, 3, 20313, 3, 19589, 3, 19596, 3; set .@size, getarraysize( .@reward ); for( set .@i, 1; .@i < .@size; .@i += 2 ) { .@percent[.@i] = .@total + .@reward[.@i]; .@total += .@reward[.@i]; } .@r = rand( .@total +1 ); for( set .@i, 1; .@i < .@size; .@i += 2 ) if( .@percent[.@i] > .@r ) break; getitem .@reward[ .@i-1 ], 1; end; } How can I make the 3% chance to be announced in all maps? and >=15% there will be no announcement. Edited July 13, 2018 by kayko11 Quote Link to comment Share on other sites More sharing options...
0 crazyarashi Posted July 13, 2018 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: 19 hours ago Share Posted July 13, 2018 Quote Link to comment Share on other sites More sharing options...
0 kayko11 Posted July 13, 2018 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 6 Reputation: 0 Joined: 10/25/17 Last Seen: August 4, 2024 Author Share Posted July 13, 2018 (edited) 1 hour ago, crazyarashi said: Thank you @crazyarashi can you double check if the code I edited if it is correct? function script box____ { setarray .i1[1],14003,14003,12914,12914,12913,12913,12900,12900,13990,13990,14158,14158,12909,12909,14004,14004,12221,12221,7776,7776; // Common Items set .i1rand,rand(1,20); // Randomize Common Items; just change max amount if you add items setarray .i2[1],12213,6320; // Rare Items set .i2rand,rand(1,2); // Randomize Rare Items; just change max amount if you add items setarray .i3[1],19599,20221,19952,19664,19954,20313,19589,19596; // Super Rare Items set .i3rand,rand(1,8); //Randomize Super Rare Items; just change max amount if you add items set .chance, rand(100); // Super Rare Item 3% if (.chance == 3){ getitem .i3[.i3rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(.i3[.i3rand])+"] from the Lucky Egg.",0; end; } // Rare Item 15% else if (.chance == 15){ getitem .i2[.i2rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(.i2[.i2rand])+"] from the Lucky Egg.",0; end; } // Common Items else { getitem .i1[.i1rand],1; end; } } Edited July 13, 2018 by kayko11 Quote Link to comment Share on other sites More sharing options...
0 Jarek Posted July 14, 2018 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 143 Reputation: 30 Joined: 12/23/11 Last Seen: March 9 Share Posted July 14, 2018 You should replace if (.chance == 3){ with if (.chance < 3){ and else if (.chance == 15){ with else if (.chance < 15){ Quote Link to comment Share on other sites More sharing options...
0 gelo221 Posted April 30, 2020 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 9 Reputation: 0 Joined: 12/09/13 Last Seen: October 4, 2021 Share Posted April 30, 2020 How to use this ??? noob sorry Quote Link to comment Share on other sites More sharing options...
-1 Haganezuka Posted July 14, 2019 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 116 Reputation: 4 Joined: 08/14/16 Last Seen: April 2 Share Posted July 14, 2019 sorry for hijacking this post, i just have a one question, how am i supposed to put a specific item amount for each item that's in there. thank you in advance. Quote Link to comment Share on other sites More sharing options...
Question
kayko11
function script box____ { setarray .@reward, 14003, 100, 14003, 100, 12914, 100, 12914, 100, 12913, 100, 12913, 100, 12900, 100, 12900, 100, 13990, 100, 13990, 100, 14158, 100, 14158, 100, 12909, 100, 12909, 100, 14004, 100, 14004, 100, 12221, 100, 12221, 100, 7776, 100, 7776, 100, 12213, 15, 6320, 15, 19599, 3, 20221, 3, 19952, 3, 19664, 3, 19954, 3, 20313, 3, 19589, 3, 19596, 3; set .@size, getarraysize( .@reward ); for( set .@i, 1; .@i < .@size; .@i += 2 ) { .@percent[.@i] = .@total + .@reward[.@i]; .@total += .@reward[.@i]; } .@r = rand( .@total +1 ); for( set .@i, 1; .@i < .@size; .@i += 2 ) if( .@percent[.@i] > .@r ) break; getitem .@reward[ .@i-1 ], 1; end; }
How can I make the 3% chance to be announced in all maps?
and >=15% there will be no announcement.
Edited by kayko11Link to comment
Share on other sites
5 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.