Jump to content
  • 0

Can't find the Item that gives one of the many items.


Meister

Question


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Forgot what to type on the search bar in the script request wherein one item can randomly give you item in a given set. 

Edited by Gnome
Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  353
  • Reputation:   70
  • Joined:  07/14/12
  • Last Seen:  


add this in your item_db2

 


30002,Random_Box,Random Box,2,10000,,200,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "itemcalc"; },{},{}

 

create a function npc


function    script    itemcalc    {

set .@quantity,1;// quantity of the item you wanna give change 1 to your choice

setarray .@item[0],30003,30004,30005,30006,30007,30008,30009;//modify these numbers to your item number of choice

 

getitem .@item[rand(getarraysize(.@item))],1;

end;

 

}

 

then 

add this in your iteminfo.lub or cskroption.lub


 

    [30002] = {

        unidentifiedDisplayName = "Random Box",

        unidentifiedResourceName  = "¿À·¡µÈÆĶõ»óÀÚ",

        unidentifiedDescriptionName = {

            "A mysterious blue box that seems to hold something inside, but you'll have to open it to find out.",

            "^ffffff_^000000",

            "Weight :^777777 20^000000",

        },

        identifiedDisplayName = "Random Box",

        identifiedResourceName = "¿À·¡µÈÆĶõ»óÀÚ",

        identifiedDescriptionName = {

            "A mysterious blue box that seems to hold something inside, but you'll have to open it to find out.",

            "^ffffff_^000000",

            "Weight : ^77777720^000000",

        },

        slotCount = 0,

        ClassNum = 0

    },

Edited by icabit
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  


add this in your item_db2
 
30002,Random_Box,Random Box,2,10000,,200,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "itemcalc"; },{},{}
 
create a function npc
function    script    itemcalc    {

set .@quantity,1;// quantity of the item you wanna give change 1 to your choice

setarray .@item[0],30003,30004,30005,30006,30007,30008,30009;//modify these numbers to your item number of choice
 
getitem .@item[rand(getarraysize(.@item))],1;
end;
 
}
 
then 
add this in your iteminfo.lub or cskroption.lub
 
    [30002] = {
        unidentifiedDisplayName = "Random Box",
        unidentifiedResourceName  = "¿À·¡µÈÆĶõ»óÀÚ",
        unidentifiedDescriptionName = {
            "A mysterious blue box that seems to hold something inside, but you'll have to open it to find out.",
            "^ffffff_^000000",
            "Weight :^777777 20^000000",
        },
        identifiedDisplayName = "Random Box",
        identifiedResourceName = "¿À·¡µÈÆĶõ»óÀÚ",
        identifiedDescriptionName = {
            "A mysterious blue box that seems to hold something inside, but you'll have to open it to find out.",
            "^ffffff_^000000",
            "Weight : ^77777720^000000",
        },
        slotCount = 0,
        ClassNum = 0
    },

Thou this is solved. I just have questions. Isn't it it set .@setquantity is uselesS? because at getitem you have set it to 1?

 

also. How to add percentage for each?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  353
  • Reputation:   70
  • Joined:  07/14/12
  • Last Seen:  

 


add this in your item_db2
 
30002,Random_Box,Random Box,2,10000,,200,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "itemcalc"; },{},{}
 
create a function npc
function    script    itemcalc    {

set .@quantity,1;// quantity of the item you wanna give change 1 to your choice

setarray .@item[0],30003,30004,30005,30006,30007,30008,30009;//modify these numbers to your item number of choice
 
getitem .@item[rand(getarraysize(.@item))],1;
end;
 
}
 
then 
add this in your iteminfo.lub or cskroption.lub
 
    [30002] = {
        unidentifiedDisplayName = "Random Box",
        unidentifiedResourceName  = "¿À·¡µÈÆĶõ»óÀÚ",
        unidentifiedDescriptionName = {
            "A mysterious blue box that seems to hold something inside, but you'll have to open it to find out.",
            "^ffffff_^000000",
            "Weight :^777777 20^000000",
        },
        identifiedDisplayName = "Random Box",
        identifiedResourceName = "¿À·¡µÈÆĶõ»óÀÚ",
        identifiedDescriptionName = {
            "A mysterious blue box that seems to hold something inside, but you'll have to open it to find out.",
            "^ffffff_^000000",
            "Weight : ^77777720^000000",
        },
        slotCount = 0,
        ClassNum = 0
    },

Thou this is solved. I just have questions. Isn't it it set .@setquantity is uselesS? because at getitem you have set it to 1?

 

also. How to add percentage for each?

ya i forgot about that one

replace it with getitem .@item[rand(getarraysize(.@item))],.@quantity;

 

replace your npc with this

 

function    script    itemcalc    {
set .@quantity,1;// quantity of the item you wanna give change 1 to your choice

setarray .@item[0],30003,30004,30005,30006,30007,30008;//modify these numbers to your item number of choice
 
set .@rand,(1,100); //so basically it will depend on your .@rand limit and make use of the max limit 
then set if cases to each item like
if ((.@rand >=1)&&(.@rand=<5)){getitem .@item[0],.@quantity;}// this will give you item you set for the 1st element of your array and the chance is 5%
if ((.@rand >=6)&&(.@rand=<15)){getitem .@item[1],.@quantity;}// this will give you item you set for the 2nd element of your array and the chance is 15%
if ((.@rand >=16)&&(.@rand=<40)){getitem .@item[2],.@quantity;}// this will give you item you set for the 3rd element of your array and the chance is 25%
if ((.@rand >=41)&&(.@rand=<70)){getitem .@item[3],.@quantity;}// this will give you item you set for the 4th element of your array and the chance is 30%
if ((.@rand >=71)&&(.@rand=<80)){getitem .@item[4],.@quantity;}// this will give you item you set for the 5th element of your array and the chance is 10%
if ((.@rand >=81)&&(.@rand=<100)){getitem .@item[5],.@quantity;}// this will give you item you set for the 6th element of your array and the chance is 20%
} 

Edited by icabit
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

I'll try this.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

 

 


add this in your item_db2
 
30002,Random_Box,Random Box,2,10000,,200,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "itemcalc"; },{},{}
 
create a function npc
function    script    itemcalc    {

set .@quantity,1;// quantity of the item you wanna give change 1 to your choice

setarray .@item[0],30003,30004,30005,30006,30007,30008,30009;//modify these numbers to your item number of choice
 
getitem .@item[rand(getarraysize(.@item))],1;
end;
 
}
 
then 
add this in your iteminfo.lub or cskroption.lub
 
    [30002] = {
        unidentifiedDisplayName = "Random Box",
        unidentifiedResourceName  = "¿À·¡µÈÆĶõ»óÀÚ",
        unidentifiedDescriptionName = {
            "A mysterious blue box that seems to hold something inside, but you'll have to open it to find out.",
            "^ffffff_^000000",
            "Weight :^777777 20^000000",
        },
        identifiedDisplayName = "Random Box",
        identifiedResourceName = "¿À·¡µÈÆĶõ»óÀÚ",
        identifiedDescriptionName = {
            "A mysterious blue box that seems to hold something inside, but you'll have to open it to find out.",
            "^ffffff_^000000",
            "Weight : ^77777720^000000",
        },
        slotCount = 0,
        ClassNum = 0
    },

Thou this is solved. I just have questions. Isn't it it set .@setquantity is uselesS? because at getitem you have set it to 1?

 

also. How to add percentage for each?

ya i forgot about that one

replace it with getitem .@item[rand(getarraysize(.@item))],.@quantity;

 

replace your npc with this

 

function    script    itemcalc    {
set .@quantity,1;// quantity of the item you wanna give change 1 to your choice

setarray .@item[0],30003,30004,30005,30006,30007,30008;//modify these numbers to your item number of choice
 
set .@rand,(1,100); //so basically it will depend on your .@rand limit and make use of the max limit 
then set if cases to each item like
if ((.@rand >=1)&&(.@rand=<5)){getitem .@item[0],.@quantity;}// this will give you item you set for the 1st element of your array and the chance is 5%
if ((.@rand >=6)&&(.@rand=<15)){getitem .@item[1],.@quantity;}// this will give you item you set for the 2nd element of your array and the chance is 15%
if ((.@rand >=16)&&(.@rand=<40)){getitem .@item[2],.@quantity;}// this will give you item you set for the 3rd element of your array and the chance is 25%
if ((.@rand >=41)&&(.@rand=<70)){getitem .@item[3],.@quantity;}// this will give you item you set for the 4th element of your array and the chance is 30%
if ((.@rand >=71)&&(.@rand=<80)){getitem .@item[4],.@quantity;}// this will give you item you set for the 5th element of your array and the chance is 10%
if ((.@rand >=81)&&(.@rand=<100)){getitem .@item[5],.@quantity;}// this will give you item you set for the 6th element of your array and the chance is 20%
} 

 

This work. What if I each item has different quantity? I'll just remove .@quantity and replace it right?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  353
  • Reputation:   70
  • Joined:  07/14/12
  • Last Seen:  

 

 

 


add this in your item_db2
 
30002,Random_Box,Random Box,2,10000,,200,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "itemcalc"; },{},{}
 
create a function npc
function    script    itemcalc    {

set .@quantity,1;// quantity of the item you wanna give change 1 to your choice

setarray .@item[0],30003,30004,30005,30006,30007,30008,30009;//modify these numbers to your item number of choice
 
getitem .@item[rand(getarraysize(.@item))],1;
end;
 
}
 
then 
add this in your iteminfo.lub or cskroption.lub
 
    [30002] = {
        unidentifiedDisplayName = "Random Box",
        unidentifiedResourceName  = "¿À·¡µÈÆĶõ»óÀÚ",
        unidentifiedDescriptionName = {
            "A mysterious blue box that seems to hold something inside, but you'll have to open it to find out.",
            "^ffffff_^000000",
            "Weight :^777777 20^000000",
        },
        identifiedDisplayName = "Random Box",
        identifiedResourceName = "¿À·¡µÈÆĶõ»óÀÚ",
        identifiedDescriptionName = {
            "A mysterious blue box that seems to hold something inside, but you'll have to open it to find out.",
            "^ffffff_^000000",
            "Weight : ^77777720^000000",
        },
        slotCount = 0,
        ClassNum = 0
    },

Thou this is solved. I just have questions. Isn't it it set .@setquantity is uselesS? because at getitem you have set it to 1?

 

also. How to add percentage for each?

ya i forgot about that one

replace it with getitem .@item[rand(getarraysize(.@item))],.@quantity;

 

replace your npc with this

 

function    script    itemcalc    {
set .@quantity,1;// quantity of the item you wanna give change 1 to your choice

setarray .@item[0],30003,30004,30005,30006,30007,30008;//modify these numbers to your item number of choice
 
set .@rand,(1,100); //so basically it will depend on your .@rand limit and make use of the max limit 
then set if cases to each item like
if ((.@rand >=1)&&(.@rand=<5)){getitem .@item[0],.@quantity;}// this will give you item you set for the 1st element of your array and the chance is 5%
if ((.@rand >=6)&&(.@rand=<15)){getitem .@item[1],.@quantity;}// this will give you item you set for the 2nd element of your array and the chance is 15%
if ((.@rand >=16)&&(.@rand=<40)){getitem .@item[2],.@quantity;}// this will give you item you set for the 3rd element of your array and the chance is 25%
if ((.@rand >=41)&&(.@rand=<70)){getitem .@item[3],.@quantity;}// this will give you item you set for the 4th element of your array and the chance is 30%
if ((.@rand >=71)&&(.@rand=<80)){getitem .@item[4],.@quantity;}// this will give you item you set for the 5th element of your array and the chance is 10%
if ((.@rand >=81)&&(.@rand=<100)){getitem .@item[5],.@quantity;}// this will give you item you set for the 6th element of your array and the chance is 20%
} 

 

This work. What if I each item has different quantity? I'll just remove .@quantity and replace it right?

yes you just need to manually put them

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Alright. Thanks!

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...