beenii
Well-Known Member
- Joined
- Jul 26, 2010
- Messages
- 580
- Solutions
- 1
- Reaction score
- 57
Hello friends, I need a voucher as indicated by the title.
But pay attention to the specifications.
This voucher, will have 3 random entries,
the first one will have:
- 100 mounts,
the second a list of:
- 20 items.
Third a List:
- 100 Addons
When player using the voucher, the voucher will give you an item or a mount or a Addon.
IMPORTANT: Each mount and item and Addon will have a chance percentage.
Example:
It must be well worked the random i recomended this:
to prevent the random number from repeating.
and finally If the player gets a repeated addon or mount, they will be given a number of Tokens, the voucher disappears when it is used, and a message of the prize that it has obtained comes out.
"congratulations you received the (NameMount or NameItem or NameAddon) ("Commun" or "Rare" or "Epic" or "Legendary") Mount or Item or addon"
if the percentage is less than or equal to 3% it will be legendary, if it is less than 10% it will be epic, less than 50% will be rare, and greater than 50% will be Common.
But pay attention to the specifications.
This voucher, will have 3 random entries,
the first one will have:
- 100 mounts,
the second a list of:
- 20 items.
Third a List:
- 100 Addons
When player using the voucher, the voucher will give you an item or a mount or a Addon.
IMPORTANT: Each mount and item and Addon will have a chance percentage.
Example:
Code:
Mounts:
local Mounts = {
[] = {
{id = 12, chance = 3, name= "xxx"},
{id = 30, chance = 3, name= "xxx"},
{id = 80, chance = 5, name= "xxx"},
{id = 4, chance = 70, name= "xxx")},
{id = 5, chance = 90, name= "xxx")}
},
local Addons= {
[] = {
{idMale = x, idFemale = x, chance = 5, name= "xxx"},
{idMale = x, idFemale = x, chance = 5, name= "xxx"},
{idMale = x, idFemale = x, chance = 1, name= "xxx"},
{idMale = x, idFemale = x, chance = 70, name= "xxx")}
},
local Items= {
[] = {
{id = 3982, chance = 5, count = 10},
{id = 2476, chance = 5, count = 1},
{id = 2479, chance = 15, count = 1},
{id = 2148, chance = 70, count = 1}
},
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
math.random(Mounts, Items, Addons)
if type == "mounts" then
Player:AddMount(List by Chance)
elseif type =="Items" then
Player:AddItem(List By Chance)
elseif type =="Addons" then
Player:AddOutfitAddon(List By Chance)
end
It must be well worked the random i recomended this:
Code:
local totalChance = 0
for i = 1, #config do
totalChance = totalChance + config[i].chance
end
math.randomseed(self:getId()+os.time())
local rand = math.random(totalChance)
local index = -1
for i = 1, #config do
if rand <= config[i].chance then
index = i
break
end
rand = rand - config[i].chance
end
to prevent the random number from repeating.
and finally If the player gets a repeated addon or mount, they will be given a number of Tokens, the voucher disappears when it is used, and a message of the prize that it has obtained comes out.
"congratulations you received the (NameMount or NameItem or NameAddon) ("Commun" or "Rare" or "Epic" or "Legendary") Mount or Item or addon"
if the percentage is less than or equal to 3% it will be legendary, if it is less than 10% it will be epic, less than 50% will be rare, and greater than 50% will be Common.