ahloi007 Posted September 5, 2019 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 78 Reputation: 1 Joined: 10/15/12 Last Seen: May 23, 2023 Share Posted September 5, 2019 Quote 30024,Lucky_Draw_Box1,Lucky Draw Box1,2,0,,0,,,,,0xFFFFFFFF,7,2,,,,,,{ getitem callfunc("F_Rand",30016,30007,30012,30008,30018,30015,30011,30010),1; },{},{} function script F_Rand { return getarg(rand(getargcount())); } Hi there, this is the random box script that I am using right now. Can I know how to add on the % to the item give out through this script ? Quote Link to comment Share on other sites More sharing options...
1 Emistry Posted September 7, 2019 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 September 7, 2019 you could use these instead. *groupranditem <group id>{,<sub_group>}; Returns the item_id of a random item picked from the group specified. The different groups and their group number are specified in 'db/(pre-)re/item_group_db.txt'. When used in conjunction with other functions, you can get a random item. For example, for a random pet lure: getitem groupranditem(IG_Taming),1; 'sub_group' is used to get the available random items of item group from specified random group. 0 for 'must' item group, and random item group is 1 until 5 (MAX_ITEMGROUP_RANDGROUP+1). More info, see doc/item_group.txt. --------------------------------------- *getrandgroupitem <group_id>{,<quantity>{,<sub_group>{,<identify>{,<char_id>}}}}; Similar to the above example, this command allows players to obtain the specified quantity of a random item from the group "<group id>". The different groups and their group number are specified in db/(pre-)re/item_group_db.txt If 'quantity' is not defined or 0, it will uses defined amount from Item Group list. If 'sub_group' is not defined the value will be 1 (since random group is 1 ~ 5, and 0 is 'must' item group). For item with type IT_WEAPON, IT_ARMOR, IT_PETARMOR, and IT_SHADOWGEAR will be given as unidentified item (as defined by itemdb_isidentified in src/map/itemdb.cpp) except if 'identify' is defined with value 1. More info, see doc/item_group.txt. --------------------------------------- *getgroupitem <group_id>{,<identify>{,<char_id>}}; Gives item(s) to the attached player based on item group contents. This is not working like 'getrandgroupitem' which only give 1 item for specified item group & sub_group. For item with type IT_WEAPON, IT_ARMOR, IT_PETARMOR, and IT_SHADOWGEAR will be given as unidentified item (as defined by itemdb_isidentified in src/map/itemdb.cpp) except if 'identify' is defined with value 1. More info, see doc/item_group.txt. Quote Link to comment Share on other sites More sharing options...
1 Start_ Posted September 5, 2019 Group: Members Topic Count: 26 Topics Per Day: 0.01 Content Count: 950 Reputation: 180 Joined: 04/05/13 Last Seen: 1 hour ago Share Posted September 5, 2019 if(getarg(1)>0){ targetIndex = n; if(rand(0,100)<=getarg(2)) getitem array[targetIndex]; } Quote Link to comment Share on other sites More sharing options...
0 ahloi007 Posted September 6, 2019 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 78 Reputation: 1 Joined: 10/15/12 Last Seen: May 23, 2023 Author Share Posted September 6, 2019 On 9/6/2019 at 12:49 AM, Start_ said: if(getarg(1)>0){ targetIndex = n; if(rand(0,100)<=getarg(2)) getitem array[targetIndex]; } I'm sorry, can you please explained in details? Because I'm still new to this... *lol Quote Link to comment Share on other sites More sharing options...
0 Start_ Posted September 7, 2019 Group: Members Topic Count: 26 Topics Per Day: 0.01 Content Count: 950 Reputation: 180 Joined: 04/05/13 Last Seen: 1 hour ago Share Posted September 7, 2019 You call this getitem callfunc("F_Rand",30016,30007,30012,30008,30018,30015,30011,30010),1; That's function F_Rand take 1 arguments is item id. Then you can easy send more argument to function like how much percent do you want to increase chance at index or whatever. By the way there are many ways to it. Quote Link to comment Share on other sites More sharing options...
0 ahloi007 Posted September 8, 2019 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 78 Reputation: 1 Joined: 10/15/12 Last Seen: May 23, 2023 Author Share Posted September 8, 2019 On 9/7/2019 at 12:22 PM, Start_ said: You call this getitem callfunc("F_Rand",30016,30007,30012,30008,30018,30015,30011,30010),1; That's function F_Rand take 1 arguments is item id. Then you can easy send more argument to function like how much percent do you want to increase chance at index or whatever. By the way there are many ways to it. Okay Thanks! I got it xD 23 hours ago, Emistry said: you could use these instead. *groupranditem <group id>{,<sub_group>}; Returns the item_id of a random item picked from the group specified. The different groups and their group number are specified in 'db/(pre-)re/item_group_db.txt'. When used in conjunction with other functions, you can get a random item. For example, for a random pet lure: getitem groupranditem(IG_Taming),1; 'sub_group' is used to get the available random items of item group from specified random group. 0 for 'must' item group, and random item group is 1 until 5 (MAX_ITEMGROUP_RANDGROUP+1). More info, see doc/item_group.txt. --------------------------------------- *getrandgroupitem <group_id>{,<quantity>{,<sub_group>{,<identify>{,<char_id>}}}}; Similar to the above example, this command allows players to obtain the specified quantity of a random item from the group "<group id>". The different groups and their group number are specified in db/(pre-)re/item_group_db.txt If 'quantity' is not defined or 0, it will uses defined amount from Item Group list. If 'sub_group' is not defined the value will be 1 (since random group is 1 ~ 5, and 0 is 'must' item group). For item with type IT_WEAPON, IT_ARMOR, IT_PETARMOR, and IT_SHADOWGEAR will be given as unidentified item (as defined by itemdb_isidentified in src/map/itemdb.cpp) except if 'identify' is defined with value 1. More info, see doc/item_group.txt. --------------------------------------- *getgroupitem <group_id>{,<identify>{,<char_id>}}; Gives item(s) to the attached player based on item group contents. This is not working like 'getrandgroupitem' which only give 1 item for specified item group & sub_group. For item with type IT_WEAPON, IT_ARMOR, IT_PETARMOR, and IT_SHADOWGEAR will be given as unidentified item (as defined by itemdb_isidentified in src/map/itemdb.cpp) except if 'identify' is defined with value 1. More info, see doc/item_group.txt. Thanks ya! just figure it out xD Quote Link to comment Share on other sites More sharing options...
Question
ahloi007
function script F_Rand { return getarg(rand(getargcount())); }
Hi there, this is the random box script that I am using right now.
Can I know how to add on the % to the item give out through this script ?
Link 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.