Jump to content
  • 0

how to create a box with random items like gift box, old blue box,...


Xemnas969696

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  08/28/20
  • Last Seen:  

Hi my friends

I try to create a box with random items but I can't. could someone guide me step by step to do this?

Thx so much for your help

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  176
  • Topics Per Day:  0.14
  • Content Count:  666
  • Reputation:   9
  • Joined:  12/04/20
  • Last Seen:  

1 hour ago, Xemnas969696 said:

Hi my friends

I try to create a box with random items but I can't. could someone guide me step by step to do this?

Thx so much for your help

1st make a custom box if you want box 

in this example i use egg scroll
 

in your db/import/item_db.yml

  - Id: 12654
    AegisName: Lucky_Egg_C9
    Name: Lucky Egg C9
    Type: Usable
    Buy: 20
    Weight: 10
    Flags:
      Container: true
    Trade:
      Override: 100
      NoDrop: true
      NoTrade: true
      NoSell: true
      NoCart: true
      NoGuildStorage: true
      NoMail: true
      NoAuction: true
    Script: |
      getitem callfunc("F_Rand",14003,12221,12208,14592,12210,12211,7621,7776),1;  



2nd in your db/item_db.yml.txt
 

12654,Lucky_Egg_C9,Lucky Egg C9,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getgroupitem(IG_Lucky_Egg_C9); },{},{}



 

Edited by Mael
Use codebox
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  08/28/20
  • Last Seen:  

on my side it's item_db.txt.

 

On 10/15/2021 at 9:55 PM, chadness said:

1st make a custom box if you want box 

in this example i use egg scroll
 

in your db/import/item_db.yml

  - Id: 12654
    AegisName: Lucky_Egg_C9
    Name: Lucky Egg C9
    Type: Usable
    Buy: 20
    Weight: 10
    Flags:
      Container: true
    Trade:
      Override: 100
      NoDrop: true
      NoTrade: true
      NoSell: true
      NoCart: true
      NoGuildStorage: true
      NoMail: true
      NoAuction: true
    Script: |
      getitem callfunc("F_Rand",14003,12221,12208,14592,12210,12211,7621,7776),1;  


2nd in your db/item_db.yml.txt

12654,Lucky_Egg_C9,Lucky Egg C9,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getgroupitem(IG_Lucky_Egg_C9); },{},{}

 

how can I do to add a rate on the random? the IG_mabox I have to declare it somewhere?

Edited by Xemnas969696
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  176
  • Topics Per Day:  0.14
  • Content Count:  666
  • Reputation:   9
  • Joined:  12/04/20
  • Last Seen:  

14 hours ago, Xemnas969696 said:

how can I do to add a rate on the random? the IG_mabox I have to declare it somewhere?

function    script    CustomBox    {
    setarray .i1[0],909,910; // Common Items
    set .i1rand,rand(0,1); // Randomize Common Items; just change max amount if you add items
    setarray .i2[0],911,912; // Rare Items
    set .i2rand,rand(0,1); // Randomize Rare Items; just change max amount if you add items
    setarray .i3[0],2199,1599; // Super Rare Items
    set .i3rand,rand(0,1); //Randomize Super Rare Items; just change max amount if you add items
    set .chance, rand(100);

        // Super Rare Item 1%
        if (.chance == 1){
        getitem .i[.i3rand],1;
        announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[0])+"] from the Special Box.",0;
        end;
        } 

        // Rare Item 50%
        else if (.chance <= 50 && .chance >= 11){
        getitem .i[.i2rand],1;
        announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[0])+"] from the Special Box.",0;
        end;
        } 

        // Common Items
        else {
        getitem .i1[.i1rand],1;
        end; }
}

 

Edited by Emistry
codebox
Link to comment
Share on other sites

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.

×
×
  • Create New...