Jump to content
  • 0

need idea on how to do this kind of script


Question

Posted (edited)
function    script    CustomBox    {

        set .@Total,65;
        setarray .@P1[0],90,983,5; //Black Dyestuff
        setarray .@P2[0],91,981,5; //Violet Dyestuff
        setarray .@P3[0],93,13517,1; //YGGBOX
        setarray .@P4[0],94,12534,1; //YGGSEED
        setarray .@P5[0],80,3016,1; //HOKAGEHAT
        setarray .@P6[0],81,3696,1; //LUFFYHAT
        setarray .@P7[0],85,740,10; //PUPPET
        setarray .@P8[0],89,720,10; //AQUAMARINE
        setarray .@P9[0],87,14176,1; //ENRICHEDELU
        setarray .@P10[0],88,14177,1; //ENRICHEDORI
        setarray .@P11[0],60,50005,1; //PREMIUMCREDIT
        setarray .@P12[0],70,3676,1; //HOLLOWMASK
        setarray .@P13[0],75,3678,1; //ROBOEARS
        setarray .@P14[0],50,19130,1; //MAGICEYES
        setarray .@P15[0],51,5184,1; //CAPTAINSHAT
            setarray .@P16[0],52,8327,1; //EVOLVED POOPOO
        setarray .@P17[0],53,3782,1; //DARKLORDHELM
        setarray .@P18[0],54,18534,1; //FANCYPHANTOM
        setarray .@P19[0],55,5325,1; //ROBOEYE
        setarray .@P20[0],51,19176,1; //FALLENANGELBLESSING
        setarray .@P21[0],56,5517,1; //HAWKEYES
        setarray .@P22[0],57,3661,1; //DEVILING WINGS
        setarray .@P23[0],58,3000,1; //ANGELINGWINGS
        setarray .@P24[0],59,3001,1; //ARTICWINGS
        setarray .@P25[0],60,3003,1; //DEMONWINGS
        setarray .@P26[0],61,3005,1; //GARGOYLEWINGS
        setarray .@P27[0],62,3007,1; //PHOENIXWINGS
        setarray .@P28[0],63,3008,1; //TORNWINGS
        setarray .@P29[0],64,3002,1; //BLACKBUTTERFLYWING
        setarray .@P30[0],65,3009,1; //WHITEBUTTERFLYWING
        setarray .@P31[0],65,2726,1; //ICARUSWINGS
        setarray .@P32[0],40,7828,1; //BRAVERYBADGE
        setarray .@P33[0],41,45078,1; //NEKOHOOD
        setarray .@P34[0],42,20073,1; //MVPHAT
        setarray .@P35[0],43,rand(45066,45072),1; //BUNDANNA
        setarray .@P36[0],40,rand(45099,45101),1; //RUNES
        setarray .@P37[0],40,45084,1; //BLACKRUNES
        setarray .@P38[0],40,rand(45026,45028),1; //BLACKAURA-PINK
        setarray .@P39[0],40,rand(45062,45065),1; //BLACKAURA-WHITE
        setarray .@P40[0],20,rand(3515,3526),1; //DRAGONWEAPON
        setarray .@P41[0],20,28605,1; //DRAGONBOOK
        setarray .@P42[0],20,3536,1; //DRAGONSHURIKEN
        setarray .@P43[0],15,rand(45211,45214),1; //FUSHIONVALKYIRE
        setarray .@P44[0],10,rand(8032,8033),1; //DIABLOSPIRIT
        setarray .@P45[0],10,20727,1; //BRILLIANTGOLDEN
        setarray .@P46[0],9,82517,1; //INVOKERCAPE
        setarray .@P47[0],2,4549,1; //UPDMAYA
        setarray .@P48[0],3,4359,1; //SINXCARD
        setarray .@P49[0],3,4357,1; //LKCARD
        setarray .@P50[0],3,4361,1; //WSCARD
        setarray .@P51[0],3,4363,1; //HIGHPRIESTCARD
        setarray .@P52[0],3,4365,1; //HIGHWIZARDCARD
        setarray .@P53[0],5,4128,1; //GTB
        setarray .@P54[0],7,3742,1; //GOLDENSWORDAURA
        setarray .@P55[0],4,40016,1; //DRAGONRING
        setarray .@P56[0],5,rand(40006,40012),1; //DRAGONSET
        setarray .@P57[0],1,rand(4480,4504),1; //SEALED
        setarray .@P58[0],1,rand(4535,4544),1; //SEALED
            setarray .@P69[0],100,7227,rand(1,5); // TCG
        setarray .@P60[0],100,7227,rand(5,10); // TCG
        setarray .@P61[0],95,6767,rand(1,10); //MVPCOIN
        setarray .@P62[0],96,3100,rand(1,10); //CREDIT
        setarray .@P63[0],97,7608,rand(1,5); //LOTTITICKET
        setarray .@P64[0],96,6420,rand(1,10); //HOURLYCOIN
        setarray .@P65[0],2,rand(40033,40034),1; //VIPBOX
    do{
        set .@i, rand(1,.@Total);
    }while( rand(1,100) > getd(".@P"+.@i+"[0]") );
    
    for(set .@j,1; .@j<getarraysize(getd(".@P"+.@i)); set .@j,.@j+2)
    {
        getitem getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
        if (!.@k[0])
        {
            set .@gz,.@i;
            setarray .@k[0], getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
            break;
        }
    }
    if( .@gz && .@gz <= 10 ) // 10% equal or below will announce
    announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" From Supply Box",0;
    specialeffect2 248;
end;
}

this is my script on random box can someone edit this script to get 10 random items instead of 1 only

Edited by Patskie
codebox

6 answers to this question

Recommended Posts

  • 0
Posted

Hello,

You can put a for around the logical that goes from 0 to 10

for(.@count = 0;.@count < 10;.@count++){
    do{
        set .@i, rand(1,.@Total);
    }while( rand(1,100) > getd(".@P"+.@i+"[0]") );
    
    for(set .@j,1; .@j<getarraysize(getd(".@P"+.@i)); set .@j,.@j+2)
    {
        getitem getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
        if (!.@k[0])
        {
            set .@gz,.@i;
            setarray .@k[0], getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
            break;
        }
    }
    if( .@gz && .@gz <= 10 ) // 10% equal or below will announce
    announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" From Supply Box",0;
    specialeffect2 248;
 }

 

  • 0
Posted
4 hours ago, Kreustoo said:

Hello,

You can put a for around the logical that goes from 0 to 10


for(.@count = 0;.@count < 10;.@count++){
    do{
        set .@i, rand(1,.@Total);
    }while( rand(1,100) > getd(".@P"+.@i+"[0]") );
    
    for(set .@j,1; .@j<getarraysize(getd(".@P"+.@i)); set .@j,.@j+2)
    {
        getitem getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
        if (!.@k[0])
        {
            set .@gz,.@i;
            setarray .@k[0], getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
            break;
        }
    }
    if( .@gz && .@gz <= 10 ) // 10% equal or below will announce
    announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" From Supply Box",0;
    specialeffect2 248;
 }

 

sir.. the question is how can i do that? and where should i put the for loop can you do it for me sir?

  • 0
Posted

In my answer there's already the loop, you just had to copy/paste to replace, but whatever:

function    script    CustomBox    {

        set .@Total,65;
        setarray .@P1[0],90,983,5; //Black Dyestuff
        setarray .@P2[0],91,981,5; //Violet Dyestuff
        setarray .@P3[0],93,13517,1; //YGGBOX
        setarray .@P4[0],94,12534,1; //YGGSEED
        setarray .@P5[0],80,3016,1; //HOKAGEHAT
        setarray .@P6[0],81,3696,1; //LUFFYHAT
        setarray .@P7[0],85,740,10; //PUPPET
        setarray .@P8[0],89,720,10; //AQUAMARINE
        setarray .@P9[0],87,14176,1; //ENRICHEDELU
        setarray .@P10[0],88,14177,1; //ENRICHEDORI
        setarray .@P11[0],60,50005,1; //PREMIUMCREDIT
        setarray .@P12[0],70,3676,1; //HOLLOWMASK
        setarray .@P13[0],75,3678,1; //ROBOEARS
        setarray .@P14[0],50,19130,1; //MAGICEYES
        setarray .@P15[0],51,5184,1; //CAPTAINSHAT
            setarray .@P16[0],52,8327,1; //EVOLVED POOPOO
        setarray .@P17[0],53,3782,1; //DARKLORDHELM
        setarray .@P18[0],54,18534,1; //FANCYPHANTOM
        setarray .@P19[0],55,5325,1; //ROBOEYE
        setarray .@P20[0],51,19176,1; //FALLENANGELBLESSING
        setarray .@P21[0],56,5517,1; //HAWKEYES
        setarray .@P22[0],57,3661,1; //DEVILING WINGS
        setarray .@P23[0],58,3000,1; //ANGELINGWINGS
        setarray .@P24[0],59,3001,1; //ARTICWINGS
        setarray .@P25[0],60,3003,1; //DEMONWINGS
        setarray .@P26[0],61,3005,1; //GARGOYLEWINGS
        setarray .@P27[0],62,3007,1; //PHOENIXWINGS
        setarray .@P28[0],63,3008,1; //TORNWINGS
        setarray .@P29[0],64,3002,1; //BLACKBUTTERFLYWING
        setarray .@P30[0],65,3009,1; //WHITEBUTTERFLYWING
        setarray .@P31[0],65,2726,1; //ICARUSWINGS
        setarray .@P32[0],40,7828,1; //BRAVERYBADGE
        setarray .@P33[0],41,45078,1; //NEKOHOOD
        setarray .@P34[0],42,20073,1; //MVPHAT
        setarray .@P35[0],43,rand(45066,45072),1; //BUNDANNA
        setarray .@P36[0],40,rand(45099,45101),1; //RUNES
        setarray .@P37[0],40,45084,1; //BLACKRUNES
        setarray .@P38[0],40,rand(45026,45028),1; //BLACKAURA-PINK
        setarray .@P39[0],40,rand(45062,45065),1; //BLACKAURA-WHITE
        setarray .@P40[0],20,rand(3515,3526),1; //DRAGONWEAPON
        setarray .@P41[0],20,28605,1; //DRAGONBOOK
        setarray .@P42[0],20,3536,1; //DRAGONSHURIKEN
        setarray .@P43[0],15,rand(45211,45214),1; //FUSHIONVALKYIRE
        setarray .@P44[0],10,rand(8032,8033),1; //DIABLOSPIRIT
        setarray .@P45[0],10,20727,1; //BRILLIANTGOLDEN
        setarray .@P46[0],9,82517,1; //INVOKERCAPE
        setarray .@P47[0],2,4549,1; //UPDMAYA
        setarray .@P48[0],3,4359,1; //SINXCARD
        setarray .@P49[0],3,4357,1; //LKCARD
        setarray .@P50[0],3,4361,1; //WSCARD
        setarray .@P51[0],3,4363,1; //HIGHPRIESTCARD
        setarray .@P52[0],3,4365,1; //HIGHWIZARDCARD
        setarray .@P53[0],5,4128,1; //GTB
        setarray .@P54[0],7,3742,1; //GOLDENSWORDAURA
        setarray .@P55[0],4,40016,1; //DRAGONRING
        setarray .@P56[0],5,rand(40006,40012),1; //DRAGONSET
        setarray .@P57[0],1,rand(4480,4504),1; //SEALED
        setarray .@P58[0],1,rand(4535,4544),1; //SEALED
            setarray .@P69[0],100,7227,rand(1,5); // TCG
        setarray .@P60[0],100,7227,rand(5,10); // TCG
        setarray .@P61[0],95,6767,rand(1,10); //MVPCOIN
        setarray .@P62[0],96,3100,rand(1,10); //CREDIT
        setarray .@P63[0],97,7608,rand(1,5); //LOTTITICKET
        setarray .@P64[0],96,6420,rand(1,10); //HOURLYCOIN
        setarray .@P65[0],2,rand(40033,40034),1; //VIPBOX
   for(.@count = 0;.@count < 10;.@count++){
    do{
        set .@i, rand(1,.@Total);
    }while( rand(1,100) > getd(".@P"+.@i+"[0]") );
    
    for(set .@j,1; .@j<getarraysize(getd(".@P"+.@i)); set .@j,.@j+2)
    {
        getitem getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
        if (!.@k[0])
        {
            set .@gz,.@i;
            setarray .@k[0], getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
            break;
        }
    }
    if( .@gz && .@gz <= 10 ) // 10% equal or below will announce
    announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" From Supply Box",0;
    specialeffect2 248;
 }
end;
}

 

  • 0
Posted (edited)
23 minutes ago, Kreustoo said:

In my answer there's already the loop, you just had to copy/paste to replace, but whatever:


function    script    CustomBox    {

        set .@Total,65;
        setarray .@P1[0],90,983,5; //Black Dyestuff
        setarray .@P2[0],91,981,5; //Violet Dyestuff
        setarray .@P3[0],93,13517,1; //YGGBOX
        setarray .@P4[0],94,12534,1; //YGGSEED
        setarray .@P5[0],80,3016,1; //HOKAGEHAT
        setarray .@P6[0],81,3696,1; //LUFFYHAT
        setarray .@P7[0],85,740,10; //PUPPET
        setarray .@P8[0],89,720,10; //AQUAMARINE
        setarray .@P9[0],87,14176,1; //ENRICHEDELU
        setarray .@P10[0],88,14177,1; //ENRICHEDORI
        setarray .@P11[0],60,50005,1; //PREMIUMCREDIT
        setarray .@P12[0],70,3676,1; //HOLLOWMASK
        setarray .@P13[0],75,3678,1; //ROBOEARS
        setarray .@P14[0],50,19130,1; //MAGICEYES
        setarray .@P15[0],51,5184,1; //CAPTAINSHAT
            setarray .@P16[0],52,8327,1; //EVOLVED POOPOO
        setarray .@P17[0],53,3782,1; //DARKLORDHELM
        setarray .@P18[0],54,18534,1; //FANCYPHANTOM
        setarray .@P19[0],55,5325,1; //ROBOEYE
        setarray .@P20[0],51,19176,1; //FALLENANGELBLESSING
        setarray .@P21[0],56,5517,1; //HAWKEYES
        setarray .@P22[0],57,3661,1; //DEVILING WINGS
        setarray .@P23[0],58,3000,1; //ANGELINGWINGS
        setarray .@P24[0],59,3001,1; //ARTICWINGS
        setarray .@P25[0],60,3003,1; //DEMONWINGS
        setarray .@P26[0],61,3005,1; //GARGOYLEWINGS
        setarray .@P27[0],62,3007,1; //PHOENIXWINGS
        setarray .@P28[0],63,3008,1; //TORNWINGS
        setarray .@P29[0],64,3002,1; //BLACKBUTTERFLYWING
        setarray .@P30[0],65,3009,1; //WHITEBUTTERFLYWING
        setarray .@P31[0],65,2726,1; //ICARUSWINGS
        setarray .@P32[0],40,7828,1; //BRAVERYBADGE
        setarray .@P33[0],41,45078,1; //NEKOHOOD
        setarray .@P34[0],42,20073,1; //MVPHAT
        setarray .@P35[0],43,rand(45066,45072),1; //BUNDANNA
        setarray .@P36[0],40,rand(45099,45101),1; //RUNES
        setarray .@P37[0],40,45084,1; //BLACKRUNES
        setarray .@P38[0],40,rand(45026,45028),1; //BLACKAURA-PINK
        setarray .@P39[0],40,rand(45062,45065),1; //BLACKAURA-WHITE
        setarray .@P40[0],20,rand(3515,3526),1; //DRAGONWEAPON
        setarray .@P41[0],20,28605,1; //DRAGONBOOK
        setarray .@P42[0],20,3536,1; //DRAGONSHURIKEN
        setarray .@P43[0],15,rand(45211,45214),1; //FUSHIONVALKYIRE
        setarray .@P44[0],10,rand(8032,8033),1; //DIABLOSPIRIT
        setarray .@P45[0],10,20727,1; //BRILLIANTGOLDEN
        setarray .@P46[0],9,82517,1; //INVOKERCAPE
        setarray .@P47[0],2,4549,1; //UPDMAYA
        setarray .@P48[0],3,4359,1; //SINXCARD
        setarray .@P49[0],3,4357,1; //LKCARD
        setarray .@P50[0],3,4361,1; //WSCARD
        setarray .@P51[0],3,4363,1; //HIGHPRIESTCARD
        setarray .@P52[0],3,4365,1; //HIGHWIZARDCARD
        setarray .@P53[0],5,4128,1; //GTB
        setarray .@P54[0],7,3742,1; //GOLDENSWORDAURA
        setarray .@P55[0],4,40016,1; //DRAGONRING
        setarray .@P56[0],5,rand(40006,40012),1; //DRAGONSET
        setarray .@P57[0],1,rand(4480,4504),1; //SEALED
        setarray .@P58[0],1,rand(4535,4544),1; //SEALED
            setarray .@P69[0],100,7227,rand(1,5); // TCG
        setarray .@P60[0],100,7227,rand(5,10); // TCG
        setarray .@P61[0],95,6767,rand(1,10); //MVPCOIN
        setarray .@P62[0],96,3100,rand(1,10); //CREDIT
        setarray .@P63[0],97,7608,rand(1,5); //LOTTITICKET
        setarray .@P64[0],96,6420,rand(1,10); //HOURLYCOIN
        setarray .@P65[0],2,rand(40033,40034),1; //VIPBOX
   for(.@count = 0;.@count < 10;.@count++){
    do{
        set .@i, rand(1,.@Total);
    }while( rand(1,100) > getd(".@P"+.@i+"[0]") );
    
    for(set .@j,1; .@j<getarraysize(getd(".@P"+.@i)); set .@j,.@j+2)
    {
        getitem getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
        if (!.@k[0])
        {
            set .@gz,.@i;
            setarray .@k[0], getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
            break;
        }
    }
    if( .@gz && .@gz <= 10 ) // 10% equal or below will announce
    announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" From Supply Box",0;
    specialeffect2 248;
 }
end;
}

 

it works dude.. but theres another problem.. the script announce the 10% and up instead of 10% and below...
and one thing is. if the announce is triggered it also announce in 10 times even if the i got the item 1 out of 10.. 

 

 

xsssdddsss.JPG

Edited by Kudo
need to upload pics
  • 0
Posted

up... can somebody solved my problem?.. i just need to know why my script announce the 10% and up instead of 10% and below.. the script indicates that 

if( .@gz && .@gz <= 10 ) // 10% equal or below will announce

so that means less than or equal to 10% right? but when i try to open the box sa 30% and above  rate chance triggered  the announce..

  • 0
Posted
On 8/16/2020 at 11:50 PM, Kudo said:

xsssdddsss.JPG

i already solved the 1st problem which is 10% and up will announcing instead of 10% and below.. i just need to place to 1% in the 1st array and so on... 
but still i cannot manage to solved my 2nd problem which is when you get 1 of the random items that chances are 10% and below.. it will announce, the problem is. it will repeat 10 times even though i only got 1 items from the 10 random  

bump~

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...